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:
I'm trying to load it as follows: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>
When Spring attempts to create the various objects, I get an exception:Code:Resource resource = new ClassPathResource("config/applicationContext.xml"); beanFactory = new XmlBeanFactory(resource); TrancheBO bo = (TrancheBO) beanFactory.getBean("trancheBO"); Collection stuff = bo.getTranchesForDeal(112);
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.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)
Any help would be greatly appreciated!
Thanks,
Paul


Reply With Quote