I am using JBoss 4.0.4 GA as application server and EJB 2.x for coding logic and Mysql 5.1 as backend. I recently changed the commit-option in jboss configuration to “B”, since we introduced some JDBC queries together with EJB. My EJB code inturn calls a stored procedure in MySql and I use CallableStatement to execute the stored procedure. I am using Innodb engine in MySQL for tables and jboss datasource is the simplest of configuration which uses . But when I execute the EJB method through a client I get following exception:
Caused by: org.jboss.resource.connectionmanager.JBossLocalXAException:
could not commit local tx; – nested throwable:
(org.jboss.resource.JBossResourceException: SQLException; – nested
throwable: (java.sql.SQLException: No operations allowed after
connection closed.)) at
org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.commit(TxConnectionManager.java:912)
at
org.jboss.tm.TransactionImpl$Resource.commit(TransactionImpl.java:2253)
at
org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:1784)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:340) …
29 moreCaused by: org.jboss.resource.JBossResourceException: SQLException; –
nested throwable: (java.sql.SQLException: No operations allowed after
connection closed.) at
org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkException(BaseWrapperManagedConnection.java:636)
at
org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.commit(LocalManagedConnection.java:73)
at
org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.commit(TxConnectionManager.java:905)
… 32 moreCaused by: java.sql.SQLException: No operations allowed after
connection closed. at
com.mysql.jdbc.Connection.checkClosed(Connection.java:1842) at
com.mysql.jdbc.Connection.commit(Connection.java:2154) at
org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.commit(LocalManagedConnection.java:69)
… 33 more
I solved the problem, it was the issue with stored procedure permissions. The data source was configured with user which don’t have rights on stored procedure. After testing with correct rights the code is working and transactions are fine. I tried executing the stored procedure with normal JDBC connection [not using datasource]. This step gave me null pointer exception by which I came to know about the access rights.
There was one clue in the long stacktrace of exception “The null” which I did not submit with last post, but for me suggested the same above with data source connection. Thanks to anyone who tried to help. I hope this might anyone else in future, was strange error for me.