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"

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章