Problem with org.jboss.tm.JBossRollbackException using jdbc:
chrismiles Jul 1, 2006 2:08 PMThis exception is being thrown by my ejbStore method.
my ejbCreate method is successfully creating a new row in the database but then fails on ejbStore.
ejbStore calls the following method to do the database work required
private void storeRow() throws SQLException { String updateStatement = "update Account set " + "credit = ?, " + "discount = ?, " + "openedDate = ?, " + "closedDate = ?, " + "where id = ?"; PreparedStatement prepStmt = con.prepareStatement(updateStatement); prepStmt.setInt(1, this.m_id.intValue()); prepStmt.setDouble(2, this.m_credit); prepStmt.setDouble(3, this.m_discount); prepStmt.setDate(4, new java.sql.Date(this.m_openedDate.getTime())); prepStmt.setDate(5, new java.sql.Date(this.m_closedDate.getTime())); int rowCount = prepStmt.executeUpdate(); prepStmt.close(); if (rowCount == 0) { throw new EJBException("Storing row for id " + m_id + " failed."); } } }
I get the following error
ull; nested exception is: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=laptop1/17, BranchQual=, localId=17] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: ejbStore: null); - nested throwable: (org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=laptop1/17, BranchQual=, localId=17] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: ejbStore: null))org.jboss.tm.JBossTransactionRolledbackException: null; nested exception is: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=laptop1/17, BranchQual=, localId=17] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: ejbStore: null); - nested throwable: (org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=laptop1/17, BranchQual=, localId=17] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: ejbStore: null)) at org.jboss.ejb.plugins.TxInterceptorCMT.throwJBossException(TxInterceptorCMT.java:569) at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:506) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361) at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161) at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145) at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107) at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:514) at org.jboss.ejb.Container.invoke(Container.java:975) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819) at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294) at sun.rmi.transport.Transport$1.run(Transport.java:153) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:149) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) at java.lang.Thread.run(Thread.java:595) Caused by: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=laptop1/17, BranchQual=, localId=17] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: ejbStore: null) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372) at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501) ... 29 more Caused by: javax.ejb.EJBException: ejbStore: null at cakeinabox.beans.AccountEJB.AccountBean.ejbStore(AccountBean.java:126) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.ejb.plugins.BMPPersistenceManager.invokeEjbStore(BMPPersistenceManager.java:498) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeEjbStore(CachedConnectionInterceptor.java:294) at org.jboss.ejb.EntityContainer.invokeEjbStore(EntityContainer.java:735) at org.jboss.ejb.GlobalTxEntityMap$2.invokeEjbStore(GlobalTxEntityMap.java:132) at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.synchronize(GlobalTxEntityMap.java:281) at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.beforeCompletion(GlobalTxEntityMap.java:345) at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491) at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324) ... 30 more
I tried
con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
but it is not supported by the database.