Results 1 to 2 of 2

Thread: Spring 1.1 and iBATIS 2.0.6

  1. #1
    Join Date
    Aug 2004
    Location
    Brookfield, WI
    Posts
    3

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Tampa, FL
    Posts
    39

    Default

    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.
    Nilesh Kapadia
    http://www.nileshk.com

Similar Threads

  1. Replies: 4
    Last Post: Mar 2nd, 2010, 02:52 AM
  2. Spring + Ibatis tutorial?
    By stevecnz in forum Data
    Replies: 2
    Last Post: Dec 10th, 2007, 11:34 AM
  3. Replies: 1
    Last Post: Feb 16th, 2006, 11:10 AM
  4. Replies: 6
    Last Post: May 25th, 2005, 01:56 AM
  5. Replies: 2
    Last Post: Nov 9th, 2004, 12:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •