我在 mysql 中使用 java、GWT 和 hibernate。为了避免太多的连接异常,我在我的应用程序中配置了 c3p0,但是在配置后,当我将应用程序部署到 tomcat 并运行应用程序时,在 5 到 10 个请求应用程序崩溃并且在 tomcat 日志中我反复收到以下异常:
org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/war] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1d2aa39]) and a value of type [com.google.inject.servlet.ServletDefinition$2] (value [com.google.inject.servlet.ServletDefinition$2@ef3675]) but failed to remove it when the web application was stopped.Threads are going to be renewed over time to try and avoid a probable memory leak.
我的c3p0配置如下:
<property name="connection.provider_class"> org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.connection.autoReconnect">true</property>
<property name="hibernate.c3p0.acquire_increment">3</property>
<property name="hibernate.c3p0.idle_test_period">5</property>
<property name="hibernate.c3p0.max_size">50</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.min_size">0</property>
<property name="hibernate.c3p0.timeout">5</property>
<property name="hibernate.c3p0.idleConnectionTestPeriod">5</property>
如果有人知道解决方案,请帮助我...在此先感谢..