-
Bug
-
Resolution: Done
-
Major
-
7.2.2.GA
-
None
When using staled connection of xa datasource, the connection throws SQLException.
Then SQLException.getSQLState() and getCause() returns null if using XA datasource.
The SQLException is re-created in the following stack.
#####: java.sql.SQLException: Error at org.jboss.jca.adapters.jdbc.WrappedConnection.checkException(WrappedConnection.java:2033) at org.jboss.jca.adapters.jdbc.WrappedStatement.checkException(WrappedStatement.java:1436) at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:509) at com.example.SelectXaServlet.doGet(SelectXaServlet.java:41)
- adapters/src/main/java/org/jboss/jca/adapters/jdbc/WrappedConnection.java
protected SQLException checkException(Throwable t) throws SQLException { Throwable result = null; if (t instanceof AbstractMethodError) { t = new SQLFeatureNotSupportedException(bundle.methodNotImplemented(), t); } if (mc != null) result = mc.connectionError(t); if (result instanceof SQLException) { throw (SQLException) result; } else { throw new SQLException("Error", result); // If the managed connection is null, create a new SQLException. } }
In the above, the managed connection is null.
This is because that the ConnectionEventListener#connectionErrorOccurred() fired by the Postgresql driver.
(oracle driver doesn't fire the event during executing statement, so this issue doen't occur.)
at org.jboss.jca.adapters.jdbc.WrappedConnection.setManagedConnection(WrappedConnection.java:120) // null set
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.cleanup(BaseWrapperManagedConnection.java:339)
- locked <0x00000000f9ea3560> (a java.util.HashSet)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.returnConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:666)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.returnConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:611)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.returnConnection(AbstractPool.java:847)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.returnManagedConnection(AbstractConnectionManager.java:725)
at org.jboss.jca.core.connectionmanager.listener.AbstractConnectionListener.connectionErrorOccurred(AbstractConnectionListener.java:472)
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.broadcastConnectionError(BaseWrapperManagedConnection.java:673)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnection.broadcastConnectionError(XAManagedConnection.java:203)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnection$1.connectionErrorOccurred(XAManagedConnection.java:91)
at org.postgresql.ds.PGPooledConnection.fireConnectionFatalError(PGPooledConnection.java:183)
at org.postgresql.ds.PGPooledConnection.fireConnectionError(PGPooledConnection.java:237)
at org.postgresql.ds.PGPooledConnection.access$200(PGPooledConnection.java:38)
at org.postgresql.ds.PGPooledConnection$StatementHandler.invoke(PGPooledConnection.java:428)
at com.sun.proxy.$Proxy64.executeQuery(Unknown Source)
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
at com.example.SelectXaServlet.doGet(SelectXaServlet.java:41)
adapters/src/main/java/org/jboss/jca/adapters/jdbc/xa/XAManagedConnection.java
public XAManagedConnection(XAManagedConnectionFactory mcf, XAConnection xaConnection, Properties props, int transactionIsolation, int psCacheSize) throws SQLException { super(mcf, xaConnection.getConnection(), props, transactionIsolation, psCacheSize); this.xaConnection = xaConnection; xaConnection.addConnectionEventListener(new javax.sql.ConnectionEventListener() { ...<snip> public void connectionErrorOccurred(javax.sql.ConnectionEvent ce) { SQLException ex = ce.getSQLException(); broadcastConnectionError(ex); // cleanup and return this connection when this event fired. } });
- clones
-
JBJCA-1391 SQLException.getSQLState() and getCause() are null with XADatasource connection for postgresql during network failure
- Resolved
-
WFLY-12315 SQLException.getSQLState() and getCause() are null with XADatasource connection for postgresql during network failure
- Closed
- is incorporated by
-
JBEAP-17178 (7.2.z) Upgrade IronJacamar from 1.4.16.Final to 1.4.17.Final
- Closed