Announcement Announcement Module
Collapse
No announcement yet.
NoClassDefFoundError: com/ibatis/common/io/ReaderInputStream Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoClassDefFoundError: com/ibatis/common/io/ReaderInputStream

    I'm trying to use Spring with iBatis; however, I get the following error when trying to create an instance of org.springframework.orm.ibatis.SqlMapClientFactory Bean.

    My xml file looks like this:
    Code:
    <bean id="trancheBO" class="com.bofa.gcib.synfin.domain.TrancheBO">
        <property name="tranchDao">
            <ref bean="trancheDao"/>
        </property>
    </bean>
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource"><ref local="dataSource"/></property>
    </bean>
    
    <bean id="sqlMap" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
        <property name="configLocation">
             <value>config/SqlMapConfig.xml</value>
       </property>
       <property name="dataSource">
            <ref local="dataSource"/>
       </property>
    </bean>
    <bean id="trancheDao" class="com.bofa.gcib.synfin.dao.SqlMapClientDaoSupportTrancheDAO">
        <property name="sqlMap"><ref local="sqlMap"/></property>
    </bean>
    I'm trying to load it as follows:
    Code:
    Resource resource = new ClassPathResource&#40;"config/applicationContext.xml"&#41;;
    beanFactory = new XmlBeanFactory&#40;resource&#41;;
    
    TrancheBO bo = &#40;TrancheBO&#41; beanFactory.getBean&#40;"trancheBO"&#41;;
    Collection stuff = bo.getTranchesForDeal&#40;112&#41;;
    When Spring attempts to create the various objects, I get an exception:

    1) testGetDealForTranche(tests.TrancheBOTest)org.spri ngframework.beans.factory.BeanCreationException: Error creating bean with name 'trancheBO' defined in class path resource [config/applicationContext.xml]: Can't resolve reference to bean 'trancheDao' while setting property 'tranchDao'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'trancheDao' defined in class path resource [config/applicationContext.xml]: Can't resolve reference to bean 'sqlMap' while setting property 'sqlMap'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sqlMap' defined in class path resource [config/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/ibatis/common/io/ReaderInputStream
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'trancheDao' defined in class path resource [config/applicationContext.xml]: Can't resolve reference to bean 'sqlMap' while setting property 'sqlMap'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sqlMap' defined in class path resource [config/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/ibatis/common/io/ReaderInputStream
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sqlMap' defined in class path resource [config/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/ibatis/common/io/ReaderInputStream
    java.lang.NoClassDefFoundError: com/ibatis/common/io/ReaderInputStream
    at com.ibatis.sqlmap.client.SqlMapClientBuilder.build SqlMapClient(SqlMapClientBuilder.java:49)
    at org.springframework.orm.ibatis.SqlMapClientFactory Bean.afterPropertiesSet(SqlMapClientFactoryBean.ja va:109)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:801)
    Note: I am using iBatis 2.0. I've checked the jar files and the package com.ibatis.common.io does not exist in the ibatis-common.jar. So, there must be a slight mixup in the versions that I am using.

    Any help would be greatly appreciated!

    Thanks,
    Paul

  • #2
    You need to add ibatis-common-2.jar (It seems you are using IBatis-2) to your CLASSPATH.
    the indeed class com/ibatis/common/io/ReaderInputStream is packaged in that jar.

    Comment


    • #3
      That did it! Thanks.

      Paul

      Comment

      Working...
      X