Announcement Announcement Module
Collapse
No announcement yet.
Spring 1.1 and iBATIS 2.0.6 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 1.1 and iBATIS 2.0.6

    Hi everyone. I am wondering if anyone is having any success using the Spring DAO framework with the latest release of iBATIS 2.0.6? I am starting out small with a pretty vanilla example. Here are the appropriate snippets from the descriptors.

    applicationContext.xml
    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <value>jdbc/myDS</value>
    </property>
    </bean>

    <bean id="sqlMap" class="org.springframework.orm.ibatis.SqlMapFactor yBean">
    <property name="configLocation"><value>WEB-INF/SqlMapConfig.xml</value></property>
    </bean>


    SqlMapConfig.xml

    <sqlMapConfig>
    <sqlMap resource="com/j2eegeek/ibatis/dao/maps/User.xml"/>
    </sqlMapConfig>

    On deploy, I get the following error and stacktrace

    ERROR [ExecuteThread: '1' for queue: 'weblogic.kernel.System'] - Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sqlMap' defined in resource [/WEB-INF/applic
    ationContext.xml] of ServletContext: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/ibatis/d
    b/sqlmap/XmlSqlMapBuilder
    java.lang.NoClassDefFoundError: com/ibatis/db/sqlmap/XmlSqlMapBuilder
    at org.springframework.orm.ibatis.SqlMapFactoryBean.a fterPropertiesSet(SqlMapFactoryBean.java:75)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBea
    nFactory.java:991)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactor
    y.java:288)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactor
    y.java:208)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:204)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:136)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.
    java:224)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:284)

    Now I am not even using the XML output feature of iBATIS but I am still getting a NoClassDefFoundError on XmlSqlMapBuilder. Any ideas before I download the source and start digging? Thanks

    --Vinny
    http://www.j2eegeek.com/blog/

  • #2
    You need to use SqlMapClientFactoryBean for iBatis 2.0. SqlMapFactoryBean is only for iBatis 1.x.

    The Spring documentation has a table which says which classes to use for 2.0: http://www.springframework.org/docs/...m.html#d0e6039

    Of course, many of the examples are for 1.x so you have to watch out for that.

    Also, in general, iBatis 1.x and 2.0 are very different, so be aware of that when looking at examples of maps, etc.

    Comment

    Working...
    X