问题描述
在spring的配置文件中,我用的是c3p0数据源bean的配置加上了destroy-method="close",关闭tomcat时就报错了,说缺少包,可是jar包明明已经导入了。但是去掉destroy-method="close"这部分就好了,这是怎么了错误信息如下:信息:Illegalaccess:thiswebapplicationinstancehasbeenstoppedalready.Couldnotloadcom.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.Theeventualfollowingstacktraceiscausedbyanerrorthrownfordebuggingpurposesaswellastoattempttoterminatethethreadwhichcausedtheillegalaccess,andhasnofunctionalimpact.java.lang.IllegalStateExceptionatorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)atorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)atcom.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:1040)atcom.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:1010)atcom.mchange.v2.resourcepool.BasicResourcePool.access$100(BasicResourcePool.java:44)atcom.mchange.v2.resourcepool.BasicResourcePool$5.run(BasicResourcePool.java:1260)Exceptioninthread"ResourceDestroyerinBasicResourcePool.close()"java.lang.NoClassDefFoundError:com/mchange/v2/resourcepool/BasicResourcePool$1DestroyResourceTaskatcom.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:1040)atcom.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:1010)atcom.mchange.v2.resourcepool.BasicResourcePool.access$100(BasicResourcePool.java:44)atcom.mchange.v2.resourcepool.BasicResourcePool$5.run(BasicResourcePool.java:1260)Causedby:java.lang.ClassNotFoundException:com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTaskatorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)atorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)...4more一月08,20158:37:01下午org.apache.coyote.AbstractProtocolstop信息:StoppingProtocolHandler["http-bio-8080"]一月08,20158:37:01下午org.apache.coyote.AbstractProtocolstop信息:StoppingProtocolHandler["ajp-bio-8009"]一月08,20158:37:01下午org.apache.coyote.AbstractProtocoldestroy信息:DestroyingProtocolHandler["http-bio-8080"]一月08,20158:37:01下午org.apache.coyote.AbstractProtocoldestroy信息:DestroyingProtocolHandler["ajp-bio-8009"]我的Spring配置如下:<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-2.5.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.5.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.5.xsd"><beanid="dataSource"class="com.mchange.v2.c3p0.ComboPooledDataSource"destroy-method="close"><propertyname="driverClass"value="com.mysql.jdbc.Driver"/><propertyname="jdbcUrl"value="jdbc:mysql://localhost:3306/hibernate1"/><propertyname="user"value="root"/><propertyname="password"value="123456"/><propertyname="initialPoolSize"value="10"/><propertyname="minPoolSize"value="2"/><propertyname="maxPoolSize"value="15"/></bean><beanid="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><propertyname="dataSource"ref="dataSource"/><propertyname="mappingResources"><list><value>cn/xlm/domain/Person.hbm.xml</value></list></property><propertyname="hibernateProperties"><value>hibernate.dialect=org.hibernate.dialect.MySQLDialecthibernate.show_sql=truehibernate.hbm2ddl.auto=update</value></property></bean><beanid="txManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager"><propertyname="sessionFactory"ref="sessionFactory"/></bean><beanid="personDaoImpl"class="cn.xlm.domain.PersonDaoImpl"></bean><tx:annotation-driventransaction-manager="txManager"/><context:annotation-config/></beans>
解决方案
本帖最后由 xlm0522 于 2015-01-08 20:47:53 编辑
解决方案二:
看看是否jar包的版本问题缺少com/mchange/v2/resourcepool/BasicResourcePool$1DestroyResourceTask这个类呢
解决方案三:
引用1楼magi1201的回复:
看看是否jar包的版本问题缺少com/mchange/v2/resourcepool/BasicResourcePool$1DestroyResourceTask这个类呢
说了,不缺少包,包都倒进来了,去掉destroy-method="close"这部分就好了,加上这部分destroy-method="close"退出tomcat就报错,但是正常的处理业务没问题。
解决方案四:
引用2楼xlm0522的回复:
Quote: 引用1楼magi1201的回复:
看看是否jar包的版本问题缺少com/mchange/v2/resourcepool/BasicResourcePool$1DestroyResourceTask这个类呢说了,不缺少包,包都倒进来了,去掉destroy-method="close"这部分就好了,加上这部分destroy-method="close"退出tomcat就报错,但是正常的处理业务没问题。
别人说的缺少类。没说少jar包。
解决方案五:
引用3楼qq_17637725的回复:
Quote: 引用2楼xlm0522的回复:
Quote: 引用1楼magi1201的回复:
看看是否jar包的版本问题缺少com/mchange/v2/resourcepool/BasicResourcePool$1DestroyResourceTask这个类呢说了,不缺少包,包都倒进来了,去掉destroy-method="close"这部分就好了,加上这部分destroy-method="close"退出tomcat就报错,但是正常的处理业务没问题。
别人说的缺少类。没说少jar包。
也看了,类也有,这个BasicResourcePool$1DestroyResourceTask也是存在的