当前位置: 代码迷 >> Java Web开发 >> java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource,该如何解决
  详细解决方案

java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource,该如何解决

热度:8348   发布时间:2016-04-11 00:11:16.0
java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource
本帖最后由 deduct1 于 2012-01-02 01:08:00 编辑
tomcat报错说找不到com.mchange.v2.c3p0.ComboPooledDataSource类,但我在随便一个类中打com.mchange.v2.c3p0,再点就能点出
ComboPooledDataSource,说明某个包中有这个类,为何还报错

12-01-01 162925  INFO XmlBeanDefinitionReader163 - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
 12-01-01 162926 ERROR ContextLoaderPlugIn230 - Context initialization failed
 org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Bean class [com.mchange.v2.c3p0.ComboPooledDataSource] not found; nested exception is java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource
java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:109)
at org.springframework.beans.factory.support.BeanDefinitionReaderUtils.createBeanDefinition(BeanDefinitionReaderUtils.java:65)



我是在web-inf下的application.xml里配dataSource:

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close" dependency-check="none">
        <property name="driverClass">
            <value>net.sourceforge.jtds.jdbc.Driver</value>
        </property>
        <property name="jdbcUrl">
           <value>jdbc:jtds:sqlserver://localhost:1433/ERP_DB</value>
        </property>
        <property name="user">
           <value>sa</value>
        </property>
        <property name="password">
           <value>pwd</value>
  相关解决方案