but has failed to stop it. This is very likely to create a memory leak(c3p0在Spring管理中,連接未關閉導致的內存溢出)


以下是錯誤日志信息:

嚴重: The web application [/news] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2014-12-19 0:27:47 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
嚴重: The web application [/news] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1pyjusp96q571f188m8|18782a7]-AdminTaskTimer] but has failed to stop it. This is very likely to create a memory leak.
2014-12-19 0:27:47 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
嚴重: The web application [/news] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1pyjusp96q571f188m8|18782a7]-HelperThread-#0] but has failed to stop it. This is very likely to create a memory leak.
2014-12-19 0:27:47 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
嚴重: The web application [/news] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1pyjusp96q571f188m8|18782a7]-HelperThread-#1] but has failed to stop it. This is very likely to create a memory leak.
2014-12-19 0:27:47 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
嚴重: The web application [/news] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1pyjusp96q571f188m8|18782a7]-HelperThread-#2] but has failed to stop it. This is very likely to create a memory leak.


堆棧信息:

Exception in thread "C3P0PooledConnectionPoolManager[identityToken->1pyjusp96q571f188m8|18782a7]-AdminTaskTimer" java.lang.NullPointerException
    at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.isLoggable(Log4jMLog.java:293)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector.run(ThreadPoolAsynchronousRunner.java:729)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)



我的情況是在配置數據源時未配置銷毀dataSource對象時執行close方法關閉連接

	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" >
		<property name="driverClass" value="${driverClass}"></property>
		<property name="jdbcUrl" value="${jdbcUrl}"></property>
		<property name="user" value="${user}"></property>
		<property name="password" value="${password}"></property>

		<property name="initialPoolSize" value="1"></property>
		<property name="minPoolSize" value="1"></property>
		<property name="maxPoolSize" value="20"></property>
		<property name="maxIdleTime" value="60"></property>
	</bean>

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" > 在這里面加入destroy-method="close"


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM