[size=large]
解决连接池泄漏步骤
登录weblogic console, %Domain% -> Services -> JDBC -> Connection Pools -> jdbc/ioa
Configuration页 -> Connection, 点开Advanced Options, 修改以下配置项状态:
配置项名称
默认值
修改为
说明
Enable Connection Leak Profiling
禁用
启用
开启连接池泄漏的监控。
Enable Connection Profiling
禁用
启用
开启连接池监控。
Inactive Connection Timeout
0
100
连接在指定时间内(单位:秒)没有活动的话,WebLogic会将之释放并回收到连接池。
以上配置项修改后不影响在跑的应用,不需要重启服务器或应用(配置项前没有黄色小图标 <!--[if !vml]--><!--[endif]-->,WebLogic很明确的告诉我们这个配置是不需要重启的),所以大可放心设置。只是启用监控后会对性能有一些影响,具体影响会有多大,我没有测试过,但开启这些设置只是暂时的,得到日志后我们就可以把配置还原会默认值。
在没有解决连接池泄漏问题之前,如果没有请求时连接池将一直保持为0,不会再有连接池满造成请求无法响应的问题,我们也不用担心再挨客户骂,也为我们解决问题争取了宝贵到时间。
好了,下面才是关键。
过一段时间后,在bea\user_projects\domains\%domainname%\%servername%目录下,打开%servername%.log,查找,"A JDBC pool connection leak was detected",如果WebLogic已经监控到有连接池泄漏的话,就可以找到以下日志,并且很清楚的告诉我们在哪一个类的哪行代码创建了连接,但没有关闭(注意红色加粗字体):
2008-5-22 上午11时47分20秒 CST Warning JDBC A JDBC pool connection leak was detected. A connection leak occurs when a connection obtained from the pool was not closed explicitly by calling close() and then was disposed by the garbage collector and returned to the connection pool. The following stack trace at create shows where the leaked connection was created. Stack trace at connection create:
at weblogic.jdbc.wrapper.PoolConnection.init(PoolConnection.java:75)
at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:254)
at weblogic.jdbc.pool.Driver.connect(Driver.java:84)
at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:546)
at weblogic.jdbc.jts.Driver.connect(Driver.java:140)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:344)
at com.cp.fw.dao.BaseDAO.getConnection(BaseDAO.java:78)
at com.cp.fw.dao.dataset.DataSetOp.init(DataSetOp.java:78)
at com.cp.fw.dao.dataset.DataSetOp.<init>(DataSetOp.java:45)
at com.cp.ia.util.WorkFlowUtil.getNextWrokFlowId(WorkFlowUtil.java:93)
at
……
另外一种方法:
在WebLogic Console,展开 %DomainName% -> Servers -> %ServerName%,选到Logging – Server页,在页面最下方点击 "View server log",同样查找 "A JDBC pool connection leak was detected",也可以找到同样的日志。
WebLogic对于日志事件的说明:
Message ID
BEA-001074
Subsystem
JDBC
Message
A JDBC pool connection leak was detected. A
connection leak occurs when a connection obtained
from the pool was not closed explicitly by calling
close() and then was disposed by the garbage
collector and returned to the connection pool. The
following stack trace at create shows where the
leaked connection was created. Stack trace at
connection create:
Detail
A JDBC pool connection leak was detected. A
connection leak occurs when a connection obtained
from the pool was not closed explicitly by calling
close() and then was disposed by the garbage
collector and returned to the connection pool. A
stack trace is printed indicating where the leaked
connection was created.
Cause
A JDBC pool connection leak was detected. A
connection leak occurs when a connection obtained
from the pool was not closed explicitly by calling
close() and then was disposed by the garbage
collector and returned to the connection pool. A
stack trace is printed indicating where the leaked
connection was created.
Action
Close the connection appropriately.
原文:http://blog.csdn.net/esky2000/archive/2008/07/22/2689929.aspx
[/size]
如何在WebLogic 8.1.6环境中查找有连接池泄漏的代码
最新推荐文章于 2021-05-16 11:43:55 发布