[EJB/JBoss] - "Transaction is not active" after rollback
by eprst
Hi,
Our EJB app contains a servlet which runs a number of daemon threads on startup. Threads access entity beans that use common JDBC connections pool.
I'm observing strange problems in the following scenario:
- daemon calls entity bean finder
- (due to our bug) finder generates NPE and fails
As far as I can see it all happens without a TX context, so there's nothing to rollback.
- another daemon thread tries to get a connection from the pool but hits "Transaction is not active".
It looks like some connection in the pool gets 'broken', daemon threads can't ever get DB connections after this.
Here's a relevant stack trace:
anonymous wrote :
| 2006-12-27 14:43:29,158 ERROR [jb.plugins.LogInterceptor] TransactionRolledbackException in method: public abstract java.util.Collection com.supportwizard.dml.interfaces.SWRecordHome.findByTableAndFieldValue(com.supportwizard.seance.Seance,java.lang.Long,java.lang.String,java.lang.Object) throws javax.ejb.FinderException,java.rmi.RemoteException, causedBy:
| java.lang.NullPointerException
| at java.lang.StringBuffer.(StringBuffer.java:104)
| at com.supportwizard.db.SQLBase.prepareColumnName(SQLBase.java:179)
| at com.supportwizard.db.SQLBase.prepareWhere(SQLBase.java:100)
| at com.supportwizard.db.SQLText_mysql.getQueryText(SQLText_mysql.java:133)
| at com.supportwizard.db.SQLText.getQueryText(SQLText.java:121)
| at com.supportwizard.db.SWInternal_SQL.sqlQuery(SWInternal_SQL.java:470)
| at com.supportwizard.db.SWInternal_SQL.sqlQuery(SWInternal_SQL.java:447)
| at com.supportwizard.utils.ejb.SWBMPEntityBean.genericMultiFind(SWBMPEntityBean.java:957)
| at com.supportwizard.utils.ejb.SWBMPEntityBean.genericMultiFind(SWBMPEntityBean.java:920)
| at com.supportwizard.utils.ejb.SWBMPEntityBean.genericMultiFind(SWBMPEntityBean.java:865)
| at com.supportwizard.utils.ejb.SWBMPEntityBean.genericMultiFind(SWBMPEntityBean.java:834)
| at com.supportwizard.dml.ejb.SWRecordBean.ejbFindByTableAndFieldValues(SWRecordBean.java:447)
| at com.supportwizard.dml.ejb.SWRecordBean.ejbFindByTableAndFieldValue(SWRecordBean.java:401)
| 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.callFinderMethod(BMPPersistenceManager.java:632)
| at org.jboss.ejb.plugins.BMPPersistenceManager.findEntities(BMPPersistenceManager.java:335)
| at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntities(CachedConnectionInterceptor.java:242)
| at org.jboss.ejb.EntityContainer.find(EntityContainer.java:706)
| at sun.reflect.GeneratedMethodAccessor179.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
| at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1130)
| at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:203)
| at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:189)
| at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
| at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:134)
| at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:76)
| at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:43)
| at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
| at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:378)
| 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.GeneratedMethodAccessor174.invoke(Unknown Source)
| 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.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
| at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
| at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:206)
| at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:192)
| at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
| at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
| at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184)
| at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
| at $Proxy1164.findByTableAndFieldValue(Unknown Source)
| at com.supportwizard.swmail.daemon.UserHelper.getUserIdByEmailColumns(UserHelper.java:208)
| at com.supportwizard.swmail.daemon.UserHelper.getUserIdByEmailAndProject(UserHelper.java:181)
| at com.supportwizard.swmail.daemon.EmailDaemon.processIncomingMail(EmailDaemon.java:243)
| at com.supportwizard.swmail.daemon.EmailDaemon.run(EmailDaemon.java:784)
| at com.supportwizard.swmail.daemon.manager.TaskCarrier.run(TaskCarrier.java:84)
| at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
| at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
| at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
| at java.lang.Thread.run(Thread.java:595)
| 2006-12-27 14:43:29,163 ERROR [.InboundEmailFilterHelper] Delete not accepted
| 2006-12-27 14:43:29,168 WARN [swmail.daemon.EmailDaemon] Checking email failed
| com.supportwizard.utils.SWRuntimeException: com.supportwizard.db.SW_SQLException: Exception in DBConnect
| at com.supportwizard.swmail.MailStorageBase.dbConnect(MailStorageBase.java:40)
| at com.supportwizard.swmail.ReceivedMailsStorage.delete(ReceivedMailsStorage.java:221)
| at com.supportwizard.swmail.daemon.EmailDaemon.run(EmailDaemon.java:785)
| at com.supportwizard.swmail.daemon.manager.TaskCarrier.run(TaskCarrier.java:84)
| at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
| at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
| at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: com.supportwizard.db.SW_SQLException: Exception in DBConnect
| at com.supportwizard.db.SWInternal_SQL.dbConnect(SWInternal_SQL.java:263)
| at com.supportwizard.db.SWInternal_SQL.dbConnect(SWInternal_SQL.java:213)
| at com.supportwizard.swmail.MailStorageBase.dbConnect(MailStorageBase.java:37)
| ... 12 more
| Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=server7/3995, BranchQual=, localId=3995]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=server7/3995, BranchQual=, localId=3995])
| at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
| at com.supportwizard.db.SWInternal_SQL.dbConnect(SWInternal_SQL.java:253)
| ... 14 more
| Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=server7/3995, BranchQual=, localId=3995]
| at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:290)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:379)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:812)
| at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
| ... 15 more
|
The first 'TransactionRolledBack' message makes me think that in fact there is a transaction, but I can't find where it is created. UserTransaction isn't used anywhere, SWRecordBean finders are marked as 'Supports'.
Of course we will fix this NPE, but the fact that such exception can leave connection pool in an inconsistent state really frightens me.
Is it a JBoss bug or we're doing something wrong?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996661#3996661
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996661
17 years, 10 months
[JCA/JBoss] - please help mysql datasource timeout problem
by jhudson
Hello,
I am using jboss 4.0.2 with a MySQL datasource (shown below) that has the idle-timeout-minutes property set to 10. But, after 8 hours of server uptime, I receive the following error when using connections from this datasource:
Communications link failure due to underlying exception:
|
| ** BEGIN NESTED EXCEPTION **
|
| java.io.EOFException
|
| STACKTRACE:
|
| java.io.EOFException
| at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1913)
| at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2304)
| at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2803)
| at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
| at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
| at com.mysql.jdbc.Connection.execSQL(Connection.java:3176)
| at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1153)
| at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1266)
| at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:296)
| at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:118)
| at org.hibernate.loader.Loader.getResultSet(Loader.java:1239)
| at org.hibernate.loader.Loader.doQuery(Loader.java:374)
| at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210)
| at org.hibernate.loader.Loader.loadEntity(Loader.java:1312)
| at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:116)
| at ...
I know that this error will occur if a connection in the pool has been idle for more than 8 hours [default setting] because the underlying connection will go stale.
My datasource file is shown below:
<datasources>
| <local-tx-datasource>
| <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
| <jndi-name>jdbc/MySQLDB</jndi-name>
| <connection-url>jdbc:mysql://localhost/db_name?autoReconnectForPools=true&dumpQueriesOnException=true&useServerPrepStmts=false</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>****</user-name>
| <password>****</password>
| <idle-timeout-minutes>10</idle-timeout-minutes>
| <min-pool-size>0</min-pool-size>
| <max-pool-size>25</max-pool-size>
|
| <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
| <metadata>
| <type-mapping>mySQL</type-mapping>
| </metadata>
| </local-tx-datasource>
| </datasources>
I should never have a connection lasting longer than 10 minutes, right? I understand that it might be a bit longer than that because the checker runs on a time interval that is half of the lowest idle-timeout-minutes but, not 8 hours...
I would really appreciate any advice you might have to offer. I have searched and searched for a possible cause and have not found any. Thank you very much.
Joe Hudson
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996651#3996651
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996651
17 years, 10 months
[Management, JMX/JBoss] - Re: twiddle + java.lang.ClassNotFoundException: org.jboss.ma
by massoo
hi,
thanks for the tip. I managed to get through with the initial error of both twiddle.log and ClassNotFoundException. Now when i execute the command :
anonymous wrote : twiddle.sh -s jnp://10.10.25.40:1099 get "jboss.management.local:name=ejb/SeakeyIncomingMessageParser,J2EEServer=Local,EJBModule=SeaKeyBackEndModule.jar,J2EEApplication=ejb.jar,j2eeType=StatelessSessionBean stats"
i get the following error
anonymous wrote : 14:27:19,874 ERROR [Twiddle] Exec failed
| javax.management.InstanceNotFoundException: jboss.management.local:name=ejb/SeakeyIncomingMessageParser,J2EEServer=Local,EJBModule=SeaKeyBackEndModule.jar,J2EEApplication=ejb.jar,j2eeType=StatelessSessionBean stats is not registered.
| at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:508)
| at org.jboss.mx.server.MBeanServerImpl.getMBeanInfo(MBeanServerImpl.java:651)
| at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:251)
| at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source)
| 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:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:164)
| at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)
| 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:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
| at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
| at sun.reflect.GeneratedMethodAccessor121.invoke(Unknown Source)
| 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)
but if i execute the command anonymous wrote : sh twiddle.sh -s jnp://10.10.25.40:1100 get "jboss.management.local:name=ejb/SeakeyIncomingMessageParser,J2EEServer=Local,EJBModule=SeaKeyBackEndModule.jar,J2EEApplication=ejb.jar,j2eeType=StatelessSessionBean"
i get the output. now my question is how to get stats for a particular module
regards
Prashant
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996646#3996646
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996646
17 years, 10 months