itstarting:IT進(jìn)行時(shí)

          想自己所想,做自己所愛

            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            28 隨筆 :: 3 文章 :: 55 評(píng)論 :: 0 Trackbacks

          解決連接池泄漏步驟

          登錄weblogic console,  %Domain% -> Services -> JDBC -> Connection Pools -> jdbc/ioa

           

          Configuration頁(yè) -> Connection, 點(diǎn)開Advanced Options, 修改以下配置項(xiàng)狀態(tài):

           

          配置項(xiàng)名稱

          默認(rèn)值

          修改為

          說(shuō)明

          Enable Connection Leak Profiling

          禁用

          啟用

          開啟連接池泄漏的監(jiān)控。

          Enable Connection Profiling

          禁用

          啟用

          開啟連接池監(jiān)控。

          Inactive Connection Timeout

          0

          100

          連接在指定時(shí)間內(nèi)(單位:秒)沒有活動(dòng)的話,WebLogic會(huì)將之釋放并回收到連接池。

           

              以上配置項(xiàng)修改后不影響在跑的應(yīng)用,不需要重啟服務(wù)器或應(yīng)用(配置項(xiàng)前沒有黃色小圖標(biāo) <!--[if !vml]--><!--[endif]-->,WebLogic很明確的告訴我們這個(gè)配置是不需要重啟的),所以大可放心設(shè)置。只是啟用監(jiān)控后會(huì)對(duì)性能有一些影響,具體影響會(huì)有多大,我沒有測(cè)試過(guò),但開啟這些設(shè)置只是暫時(shí)的,得到日志后我們就可以把配置還原會(huì)默認(rèn)值。

          在沒有解決連接池泄漏問題之前,如果沒有請(qǐng)求時(shí)連接池將一直保持為0,不會(huì)再有連接池滿造成請(qǐng)求無(wú)法響應(yīng)的問題,我們也不用擔(dān)心再挨客戶罵,也為我們解決問題爭(zhēng)取了寶貴到時(shí)間。

           

                 好了,下面才是關(guān)鍵。

           

                 過(guò)一段時(shí)間后,在bea\user_projects\domains\%domainname%\%servername%目錄下,打開%servername%.log,查找,"A JDBC pool connection leak was detected",如果WebLogic已經(jīng)監(jiān)控到有連接池泄漏的話,就可以找到以下日志,并且很清楚的告訴我們?cè)谀囊粋€(gè)類的哪行代碼創(chuàng)建了連接,但沒有關(guān)閉(注意紅色加粗字體):


           

          2008-5-22 上午11時(shí)4720 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頁(yè),在頁(yè)面最下方點(diǎn)擊 "View server log",同樣查找 "A JDBC pool connection leak was detected",也可以找到同樣的日志。

           

          WebLogic對(duì)于日志事件的說(shuō)明:

           

          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
          posted on 2008-11-13 00:41 IT進(jìn)行時(shí) 閱讀(1961) 評(píng)論(0)  編輯  收藏 所屬分類: Java Tips
          主站蜘蛛池模板: 巨野县| 和林格尔县| 黄梅县| 陕西省| 垦利县| 乌海市| 瑞安市| 南雄市| 江川县| 阳原县| 阜南县| 永嘉县| 新昌县| 九江市| 全椒县| 临江市| 柘荣县| 通化县| 富阳市| 股票| 双流县| 鱼台县| 孙吴县| 耿马| 扶沟县| 鄂托克前旗| 靖边县| 慈溪市| 邻水| 平陆县| 遂溪县| 岗巴县| 江西省| 灌阳县| 肃宁县| 五大连池市| 济宁市| 黄冈市| 涪陵区| 汉寿县| 德兴市|