PDA

View Full Version : NoClassDefFoundError: com/ibatis/common/io/ReaderInputStream


plester613
Aug 14th, 2004, 03:13 PM
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:

<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.DataSourceTran sactionManager">
<property name="dataSource"><ref local="dataSource"/></property>
</bean>

<bean id="sqlMap" class="org.springframework.orm.ibatis.SqlMapClientFactory Bean">
<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.SqlMapClientDaoSupportTra ncheDAO">
<property name="sqlMap"><ref local="sqlMap"/></property>
</bean>


I'm trying to load it as follows:


Resource resource = new ClassPathResource("config/applicationContext.xml");
beanFactory = new XmlBeanFactory(resource);

TrancheBO bo = (TrancheBO) beanFactory.getBean("trancheBO");
Collection stuff = bo.getTranchesForDeal(112);


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

irbouho
Aug 14th, 2004, 03:19 PM
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.

plester613
Aug 14th, 2004, 03:27 PM
That did it! Thanks.

Paul