1.DEBUG -- CLOSE BY CLIENT STACK TRACE

最近用c3p0遇到各种奇怪的问题,也不知道是它不行还是我不行。

今天又遇到了一个“DEBUG -- CLOSE BY CLIENT STACK TRACE”这个错误。


将日志级别提升,就算解决问题了吗?最多只能算是眼不见心不烦。


研究后我发现了一个不报这个错的方法:

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">

        <property name="driverClass" value="${jdbc.driverClassName}"/>

        <property name="jdbcUrl" value="${jdbc.url}" />

        <property name="user" value="${jdbc.username}" />

        <property name="password" value="${jdbc.password}" />

        <property name="minPoolSize" value="${c3p0.minPoolSize}"/>

        <property name="maxPoolSize" value="${c3p0.maxPoolSize}"/>

        <property name="initialPoolSize" value="${c3p0.initialPoolSize}"/>

        <property name="maxIdleTime" value="${c3p0.maxIdleTime}"/>

        <property name="maxStatements" value="${c3p0.max_statement}"/>

    </bean>


将配置文件中的红字去掉就好了。

2.ORACLE CLOSE BY CLIENT STACK TRACE

部署一个项目启动的时候debug打印出好多错误

其中,CLOSE BY CLIENT STACK TRACE  是第一错误

使用的是Myeclipse 8.5

框 架: hibernate 3.0  ,spring 3.0  ,maven2 等

web服务器 :resin3.1.10

错误信息如下所示:

Exception代码 

java.lang.Exception: DEBUG -- CLOSE BY CLIENT STACK TRACE  

    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:566)  

    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234)  

    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)  

    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)  

    at com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:989)  

    at com.mchange.v2.resourcepool.BasicResourcePool.access$100(BasicResourcePool.java:32)  

    at com.mchange.v2.resourcepool.BasicResourcePool$5.run(BasicResourcePool.java:1174)  

…………  

Caused by: org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available.   

Add CGLIB to the class path or specify proxy interfaces. 

java.lang.Exception: DEBUG -- CLOSE BY CLIENT STACK TRACE

 at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:566)

 at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234)

 at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)

 at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)

 at com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:989)

 at com.mchange.v2.resourcepool.BasicResourcePool.access$100(BasicResourcePool.java:32)

 at com.mchange.v2.resourcepool.BasicResourcePool$5.run(BasicResourcePool.java:1174)

…………

Caused by: org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available.

Add CGLIB to the class path or specify proxy interfaces.

解决方法:

在maven2的配置文件中,初始化下载的一些jar包中,加入cglib2.2 jar包的下载

Xml代码 

<dependency> 

    <groupId>cglib</groupId> 

    <artifactId>cglib</artifactId> 

    <version>2.2</version> 

</dependency> 

<dependency>

 <groupId>cglib</groupId>

 <artifactId>cglib</artifactId>

 <version>2.2</version>

</dependency>


再次启动时,debug报错消失


在resin服务器的lib下发现,当配置 上面的xml时候,会有包 cglib-2.2.jar 加载过来

可见,以上的错误信息是由于缺少这个包造成的,在相应的 lib中加入该包,就不会有这个问题了。