2 tfvglin tfvglin 于 2015.07.22 20:06 提问

ssh使用tomcat中配置好的c3p0数据源报错 10C

tomcat中对应项目的xml文件配置为:

 <?xml version="1.0" encoding="UTF-8"?>
<Context path="/Village" docBase="D:\Workspaces\MyEclipse 10\webproject\Village\WebRoot"  reloadable= "true" privileged="true">

<Resource name="jdbc/village" auth="Container"  
         type="com.mchange.v2.c3p0.ComboPooledDataSource"  
        factory="org.apache.naming.factory.BeanFactory"  
        driverClass="com.mysql.jdbc.Driver"  
        jdbcUrl="jdbc:mysql://localhost:3306/village"  
        user="root"  
        password="0510"  
        minPoolSize="10"  
        maxPoolSize="200"  
        maxIdleTime="1000" 
        idleConnectionTestPeriod="10"
        initialPoolSize="5" 
        />

</Context>

spring中引入数据源配置如下:

     <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName"><value>java:comp/env/jdbc/village</value></property>
     </bean> 

项目刚刚运行时没有问题,但是过一段时间后就会不停的报如下错误:

 Illegal access: this web application instance has been stopped already.  Could not load com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
    at com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:980)
    at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourcePool.java:1406)
    at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourcePool.java:1378)
    at com.mchange.v2.resourcepool.BasicResourcePool.cullExpired(BasicResourcePool.java:1462)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$1900(BasicResourcePool.java:32)
    at com.mchange.v2.resourcepool.BasicResourcePool$CullTask.run(BasicResourcePool.java:1937)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)
Exception in thread "Timer-1" java.lang.NoClassDefFoundError: com/mchange/v2/resourcepool/BasicResourcePool$1DestroyResourceTask
    at com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:980)
    at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourcePool.java:1406)
    at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourcePool.java:1378)
    at com.mchange.v2.resourcepool.BasicResourcePool.cullExpired(BasicResourcePool.java:1462)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$1900(BasicResourcePool.java:32)

    at com.mchange.v2.resourcepool.BasicResourcePool$CullTask.run(BasicResourcePool.java:1937)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
    ... 8 more

tomcat的lib中已经添加了c3p0-0.9.2.1.jar 包

4个回答

CSDNXIAON
CSDNXIAON   2015.07.22 20:09

tomcat中配置使用c3p0
Tomcat配置c3p0数据源
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

cuiwei1026522829
cuiwei1026522829   Ds   Rxr 2015.07.22 20:31

Caused by: java.lang.ClassNotFoundException: com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask

没发现,但是我建议你重新配置一下tomcat里的xml配置,尤其是Myeclipse 10 ,这种目录中间带空格,最好不要有,不见的碍事,但是有时候
会有问题

tfvglin
tfvglin 回复dinikinmi: 这个工作目录我用很久了 应该不是这个空格的问题
2 年多之前 回复
dinikinmi
dinikinmi 带空格好像不能建立workspace
2 年多之前 回复
ClementAD
ClementAD   2015.07.28 20:46

不要用这种落后的连接池了。看看这种吧(HikariCP):http://blog.csdn.net/clementad/article/details/46928621

ClementAD
ClementAD   2015.07.28 20:46

不要用这种落后的连接池了。看看这种吧(HikariCP):http://blog.csdn.net/clementad/article/details/46928621

ClementAD
ClementAD 回复tfvglin: 不用怎么研究,很容易用的。配置比c3p0还简单。
2 年多之前 回复
tfvglin
tfvglin 额... 有时间研究一下
2 年多之前 回复
tfvglin
tfvglin 额... 有时间研究一下
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片