10

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

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 包

查看全部
tfvglin
tfvglin
2015/07/22 12:06
  • ssh
  • 数据源
  • c3p0
  • 点赞
  • 收藏
  • 回答
    私信

3个回复