About Spring configuration (Cannot find class [Org.apache.commons.dbcp.BasicDataSource] issues)

Source: Internet
Author: User
Tags addchild

MyEclipse throws an exception

1Org.springframework.beans.factory.CannotLoadBeanClassException:Cannot Findclass[Org.apache.commons.dbcp.BasicDataSource] forBean with Name'DataSource'DefinedinchURL [file:/opt/app-w/apache-tomcat-7.0. Wu/webapps/telemetry/web-inf/classes/spring/applicationcontext.xml]; Nested exception isJava.lang.ClassNotFoundException:org.apache.commons.dbcp.BasicDataSource2At Org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass (Abstractbeanfactory.java:1278)3At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType ( Abstractautowirecapablebeanfactory.java:575)4At Org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean (Abstractbeanfactory.java:1347)5At Org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean (Abstractbeanfactory.java:913)6At Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( Defaultlistablebeanfactory.java:617)7At Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( Abstractapplicationcontext.java:934)8At Org.springframework.context.support.AbstractApplicationContext.refresh (Abstractapplicationcontext.java:479)9At Org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext (Contextloader.java:410)TenAt Org.springframework.web.context.ContextLoader.initWebApplicationContext (Contextloader.java:306) OneAt Org.springframework.web.context.ContextLoaderListener.contextInitialized (Contextloaderlistener.java: the) AAt Org.apache.catalina.core.StandardContext.listenerStart (Standardcontext.java:4973) -At Org.apache.catalina.core.StandardContext.startInternal (Standardcontext.java:5467) -At Org.apache.catalina.util.LifecycleBase.start (Lifecyclebase.java: Max) theAt Org.apache.catalina.core.ContainerBase.addChildInternal (Containerbase.java:901) -At Org.apache.catalina.core.ContainerBase.addChild (Containerbase.java:877) -At Org.apache.catalina.core.StandardHost.addChild (Standardhost.java:632) -At Org.apache.catalina.startup.HostConfig.deployDirectory (Hostconfig.java:1247) +At Org.apache.catalina.startup.hostconfig$deploydirectory.run (Hostconfig.java:1898) -At Java.util.concurrent.executors$runnableadapter.call (Executors.java:471) +At Java.util.concurrent.FutureTask.run (Futuretask.java:262) AAt Java.util.concurrent.ThreadPoolExecutor.runWorker (Threadpoolexecutor.java:1145) atAt Java.util.concurrent.threadpoolexecutor$worker.run (Threadpoolexecutor.java:615) -At Java.lang.Thread.run (Thread.java:745) - caused By:java.lang.ClassNotFoundException:org.apache.commons.dbcp.BasicDataSource -At Org.apache.catalina.loader.WebappClassLoader.loadClass (Webappclassloader.java:1720) -At Org.apache.catalina.loader.WebappClassLoader.loadClass (Webappclassloader.java:1571) -At Org.springframework.util.ClassUtils.forName (Classutils.java:265) inAt Org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass ( Abstractbeandefinition.java:419) -At Org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass (Abstractbeanfactory.java:1299) toAt Org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass (Abstractbeanfactory.java:1270) +... A More -  -- on- A  One: -:TenOrg.springframework.web.context.ContextLoader ERROR Context Initialization failed

Workaround:

Missing Commons-dbcp.jar, Commons-pool.jar these two packages

Add in Pom.xml:

1    <dependency> 2         <groupId>commons-dbcp</groupId> 3         <artifactId> Commons-dbcp</artifactid> 4         <version>1.4</version> 5     </ Dependency> 6      7     <dependency> 8         <groupId> Commons-pool</groupid> 9         <artifactId>commons-pool</artifactId>         <version>1.6</version>     </dependency>

About Spring configuration (Cannot find class [Org.apache.commons.dbcp.BasicDataSource] problem)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.