这个生产问题现在占据了我的主导地位。我已配置使用Bitronix作为jBPM5工具的事务管理器。它很长一段时间都很好用,但突然开始断裂,以下情况除外。
异常堆栈跟踪
Caused by: java.sql.SQLException: unable to get a connection from pool of a PoolingDataSource containing an XAPool of resource jdbc/jbpm-ds with 1 connection(s) (1 still available)
at bitronix.tm.resource.jdbc.PoolingDataSource.getConnection(PoolingDataSource.java:262)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:71)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
... 78 more
Caused by: bitronix.tm.internal.BitronixRuntimeException: cannot get valid connection from an XAPool of resource jdbc/jbpm-ds with 1 connection(s) (1 still available) after trying for 30s
at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:160)
at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:91)
at bitronix.tm.resource.jdbc.PoolingDataSource.getConnection(PoolingDataSource.java:258)
... 80 more
Caused by: java.sql.SQLRecoverableException: IO Error: Connection timed out
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:899)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1175)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1296)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3613)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3657)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1495)
at bitronix.tm.resource.jdbc.JdbcPooledConnection.testConnection(JdbcPooledConnection.java:215)
at bitronix.tm.resource.jdbc.JdbcPooledConnection.getConnectionHandle(JdbcPooledConnection.java:299)
at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:130)
... 82 more
Caused by: java.net.SocketException: Connection timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at oracle.net.ns.Packet.receive(Packet.java:308)
at oracle.net.ns.DataPacket.receive(DataPacket.java:106)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:324)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:268)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:190)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:107)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:124)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:80)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1137)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:350)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:208)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:886)
... 90 more
奇怪的是,应用程序有足够数量的XA连接,并且在XAPool中可用。它接受连接,尝试连接,无法连接,然后放弃连接,接受新的连接进行处理。
SEVERE: unable to get a connection from pool of a PoolingDataSource containing an XAPool of resource jdbc/jbpm-ds with 9 connection(s) (9 still available)
SEVERE: unable to get a connection from pool of a PoolingDataSource containing an XAPool of resource jdbc/jbpm-ds with 8 connection(s) (8 still available)
SEVERE: unable to get a connection from pool of a PoolingDataSource containing an XAPool of resource jdbc/jbpm-ds with 7 connection(s) (7 still available)
有人能告诉我们从这个问题中恢复过来吗?
更新1:
经过一番尝试,我能够在当地重现同样的问题。一旦数据库连接被重新设置或者我的应用程序&数据库,PoolingDataSource(由Bitronix提供)池中的池连接无效。我的问题是为什么它无法自动恢复?有什么原因可以让我们自动恢复或建立新的连接吗?
我使用的是btm
版本2.1.4
。
谢谢,Mayank
我遇到了同样的问题,但这是由于用户权限的原因。我的用户没有足够的权限,所以我遇到了这个问题。在那之后,我运行了下面提到的3个命令来创建一个新用户,这对我来说很有效。我希望它能帮助到别人。
- CREATE USER'newuser'@'localhost'由'password'标识
- 授予*.*的所有特权TO"新用户"@"本地主机"
- 同花顺特权