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

java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource解决方法

热度:10738   发布时间:2013-02-25 21:11:26.0
java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource
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:
HTML code
    <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>        </property>



------解决方案--------------------------------------------------------
类没有编译过去或类中有错
------解决方案--------------------------------------------------------
ClassNotFoundException
你的web xml配置文件有没有把application xml配置进去?
获取说配置的路径错误!!!!
------解决方案--------------------------------------------------------
同意二楼的说法。
------解决方案--------------------------------------------------------
确定你c3p0是不是在你web项目的classpath下面
------解决方案--------------------------------------------------------
确定你c3p0是不是在你web项目的classpath下面
  相关解决方案