问题描述:
java.net.SocketException:打开端口 60,028 上服务器 /172.17.138.41 的套接字时出错,消息为:Too many open files。 ERRORCODE=-4499, SQLSTATE=08001
问题定位:
1. 在AIX命令行输入'netstat -an|grep 60028|wc -l', 发现数据库连接数达到连接池最大限制
2. 进入weblogic控制台,打开左侧菜单,配置连接池监控:
[Services] -> [JDBC] -> [Data Sources] -> [JDBC Data Source-0]
3. 打开标签项[Configration]下的[Diagnostics],选中以下配置项:
Profile Connection Usage
Profile Connection Reservation Wait
Profile Connection Leak
Profile Statement Usage
3. 保存weblogic配置生效,查看weblogic的domain日志[domain/servers/AdminServer/logs/AdminServer.log]发现:
####<2012-5-30 上午06时56分35秒 CST> <Warning> <JDBC> <ppcsonl_svc> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> < > <> <1338332195484> <BEA-001153> <Forcibly releasing inactive connection "weblogic.jdbc.wrapper.PoolConnection_com_ibm_db2_jcc_t4_b@a2531" back into the connection pool "JDBC_CIA BKEDB", currently reserved by: java.lang.Exception at weblogic.jdbc.common.internal.ConnectionEnv.setup(ConnectionEnv.java:308) at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:314) at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:292) at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:425) at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:316) at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:93) at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:106) at weblogic.jdbc.pool.Driver.connect(Driver.java:149) at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:642) at weblogic.jdbc.jts.Driver.connect(Driver.java:124) at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:338) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) at cia.broker.common.jdbc.DBAccessor.updateTblPara02(DBAccessor.java:929) at cia.broker.quartz.ccb.ctrl.CCBBatchCollectProcCtrl.execute(CCBBatchCollectProcCtrl.java:156) at sun.reflect.GeneratedMethodAccessor199.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599)
3. 检查domain日志中的红色部分代码,发现数据库连接未释放,修改代码后问题解决