问题描述
WARN-com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@bbd995--AcquisitionAttemptFailed!!!Clearingpendingacquires.Whiletryingtoacquireaneedednewresource,wefailedtosucceedmorethanthemaximumnumberofallowedacquisitionattempts(30).Lastacquisitionattemptexception:com.ibm.db2.jcc.c.DisconnectException:[ibm][db2][jcc][t4][2043][11550]异常java.net.ConnectException:打开端口50,000上服务器/172.21.140.38的套接字时出错,消息为:Connectiontimedout:connect。atcom.ibm.db2.jcc.b.yb.a(yb.java:375)atcom.ibm.db2.jcc.b.yb.<init>(yb.java:76)atcom.ibm.db2.jcc.b.a.v(a.java:254)atcom.ibm.db2.jcc.b.b.a(b.java:1669)atcom.ibm.db2.jcc.c.p.a(p.java:350)atcom.ibm.db2.jcc.c.p.<init>(p.java:404)atcom.ibm.db2.jcc.b.b.<init>(b.java:256)atcom.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:163)atcom.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)atcom.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)atcom.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)atcom.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)atcom.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)atcom.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)atcom.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)atcom.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)Causedby:java.net.ConnectException:Connectiontimedout:connectatjava.net.PlainSocketImpl.socketConnect(NativeMethod)atjava.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)atjava.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)atjava.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)atjava.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)atjava.net.Socket.connect(Socket.java:525)atcom.ibm.db2.jcc.b.bb.run(bb.java:34)atjava.security.AccessController.doPrivileged(NativeMethod)atcom.ibm.db2.jcc.b.yb.a(yb.java:369)...15moreWARN-com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@c9cece--AcquisitionAttemptFailed!!!Clearingpendingacquires.Whiletryingtoacquireaneedednewresource,wefailedtosucceedmorethanthemaximumnumberofallowedacquisitionattempts(30).Lastacquisitionattemptexception:com.ibm.db2.jcc.c.DisconnectException:[ibm][db2][jcc][t4][2043][11550]异常java.net.ConnectException:打开端口50,000上服务器/172.21.140.38的套接字时出错,消息为:Connectiontimedout:connect。atcom.ibm.db2.jcc.b.yb.a(yb.java:375)atcom.ibm.db2.jcc.b.yb.<init>(yb.java:76)atcom.ibm.db2.jcc.b.a.v(a.java:254)atcom.ibm.db2.jcc.b.b.a(b.java:1669)atcom.ibm.db2.jcc.c.p.a(p.java:350)atcom.ibm.db2.jcc.c.p.<init>(p.java:404)atcom.ibm.db2.jcc.b.b.<init>(b.java:256)atcom.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:163)atcom.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)atcom.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)atcom.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)atcom.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)atcom.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)atcom.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)atcom.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)atcom.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)Causedby:java.net.ConnectException:Connectiontimedout:connectatjava.net.PlainSocketImpl.socketConnect(NativeMethod)atjava.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)atjava.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)atjava.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)atjava.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)atjava.net.Socket.connect(Socket.java:525)atcom.ibm.db2.jcc.b.bb.run(bb.java:34)atjava.security.AccessController.doPrivileged(NativeMethod)atcom.ibm.db2.jcc.b.yb.a(yb.java:369)...15more
解决方案
解决方案二:
Causedby:java.net.ConnectException:Connectiontimedout:connect是不是连接数据库的用户名那块不对啊数据驱动什么的写错了
解决方案三:
你应该ping不到那个ip地址的计算机把?不然连接怎么可能timeout呢?!
解决方案四:
先看看能否ping通装数据库的主机。。
解决方案五:
把你连数据库的代码贴来看下!
解决方案六:
可能你的端口号已近被占用了,
解决方案七:
貌似服务端连接用光,看看你是不是没有释放连接
解决方案八:
晕咯。。我的也是、、、SQL2005装咯5次还是一样的报错。。。。。。
解决方案:
/172.21.140.38:50000用telnet试试能否打开这个端口,应该是没法连接到这个端口,所以出现连接超时现象
解决方案:
看看能否ping通主机……
解决方案:
和DB服务器的连接出了问题,如果不行的话,确认一下网络通信吧
解决方案:
我也经常遇到这个问题!
解决方案:
java里看到数据库连不上的问题,先用客户端工具(你是DB2数据库,客户端用db2cmd)看是否能成功连接,如果客户端工具都连不上,那就是数据库本身的问题,跟你的java应用无关
解决方案:
额·把防火墙关了啦···
解决方案:
你telnet主机试试,通了后再连接
解决方案:
wefailedtosucceedmorethanthemaximumnumberofallowedacquisitionattempts(30)根据这句胡我猜测是数据库连接池的连接数目超过最大数了(似乎是30个)一般有2个原因:1、你的应用并发量太大(而且持久层有长事务,就是一组sql要都执行才会commit,但是这些sql可能由于用户的操作停顿而等待,减少这种事务操作),导致连接池耗光。2、持久层事物在执行sql后没有提交或回滚(遇到错误没有回滚,这种错误最容易犯。),导致连接池资源耗尽。仅供参考