-
May 5th, 2008, 08:47 AM
#1
org.springframework.beans.factory.CannotLoadBeanCl assException
hi all!,
I am trying to integrate spring with ibatis. And I am getting the following errors. I am trying a lot but unable to resolve the issue. The error which I am getting is pasted below. Please help me out to get this done.
Thanks
org.springframework.beans.factory.CannotLoadBeanCl assException: Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
Caused by: java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassU tils.java:201)
at org.springframework.beans.factory.support.Abstract BeanDefinition.resolveBeanClass(AbstractBeanDefini tion.java:327)
at org.springframework.beans.factory.support.Abstract BeanFactory.resolveBeanClass(AbstractBeanFactory.j ava:1075)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:282)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:91)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:75)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
at com.developersBook.iBatis.client.IBatisClient.main (IBatisClient.java:14)
-
May 5th, 2008, 03:44 PM
#2
Add common-dbcp.jar to your classpath. You can get it from spring-framework\lib\jakarta-commons.
-
May 6th, 2008, 12:05 AM
#3
org.springframework.beans.factory.CannotLoadBeanCl assException
I have already added the common-dbcp.jar file.
My error is removed if I add the following line
<bean id="dataSource" class="org.springframework.jdbc.datasource.SingleC onnectionDataSource" destroy-method="destroy">
instead of
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
in applicationContext.xml. You have any idea why it is so.
Thanks
-
May 6th, 2008, 05:53 AM
#4
you're posting this on the wrong forum, but it looks like a collision. Could it be that you have multiple versions on your classpath?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules