Announcement Announcement Module
No announcement yet.
Spring 1.1 and iBATIS 2.0.6 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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.

    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">

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


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

    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
    java.lang.NoClassDefFoundError: com/ibatis/db/sqlmap/XmlSqlMapBuilder
    at org.springframework.orm.ibatis.SqlMapFactoryBean.a fterPropertiesSet(
    at AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBea
    at AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactor
    at AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactor
    at BeanFactory.getBean(
    at BeanFactory.getBean(
    at istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.
    at 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


  • #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:

    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.