案子中使用的container是weblogic 8.1。最近工作上寫的系統,偶爾會發connetion leak。長官執疑什麼是connection leak? 在請教過google大神後,才在BEA的官網中找到一些資訊。
在weblogic 8.1中發生connection leak時會產生<BEA-001074>錯誤。那什麼叫connection leak? "BEA官方解釋是:
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...
如何知道那裡有發生connection leak呢?
首先要在 startup scripts (startWeblogic.cmd)中加入 -Dweblogic.Debug=weblogic.JDBCConn="true", weblogic.JTAJDBC="true"
另外要設定weblogic中domain的config.xml中的指定連線 ConnLeakProfilingEnabled屬性為true。
<JDBCConnectionPool ConnLeakProfilingEnabled="true"
ConnProfilingEnabled="true"
DriverName="oracle.jdbc.OracleDriver"
InactiveConnectionTimeoutSeconds="0" MaxCapacity="20"....
其實設定ConnLeakProfilingEnabled也可以透過weblogic console中設定。
其中Inactive Connection Timeout要設定為0
沒有留言 :
張貼留言