MDB - IllegalStateException: No event context active
jgilbert Dec 1, 2008 10:13 PMI have an MDB that is a component and it calls SLSBs that are also components. When the SLSBs have a seam managed entityManager I am getting the following exception.
2008-12-01 14:50:59,029 ERROR [org.jboss.seam.transaction.SynchronizationRegistry] Exception processing transaction Synchronization after completion java.lang.IllegalStateException: No event context active at org.jboss.seam.ScopeType.getContext(ScopeType.java:114) at org.jboss.seam.Component.getInstance(Component.java:1956) at org.jboss.seam.Component.getInstance(Component.java:1951) at org.jboss.seam.Component.getInstance(Component.java:1924) at org.jboss.seam.Component.getInstance(Component.java:1919) at org.jboss.seam.transaction.Transaction.instance(Transaction.java:36) at org.jboss.seam.persistence.ManagedPersistenceContext.close(ManagedPersistenceContext.java:191) at org.jboss.seam.persistence.ManagedPersistenceContext.afterCompletion(ManagedPersistenceContext.java:180) at org.jboss.seam.transaction.SynchronizationRegistry.afterTransactionCompletion(SynchronizationRegistry.java:42) at org.jboss.seam.transaction.EjbSynchronizations.afterCompletion(EjbSynchronizations.java:80) at org.jboss.ejb3.stateful.SessionSynchronizationInterceptor$SFSBSessionSynchronization.afterCompletion(SessionSynchronizationInterceptor.java:87) at org.jboss.tm.TransactionImpl.doAfterCompletion(TransactionImpl.java:3109) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:1294) at org.jboss.tm.TxManager.commit(TxManager.java:588) at org.jboss.jms.asf.StdServerSession$TransactionDemarcation.end(StdServerSession.java:503) at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:219) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756) at java.lang.Thread.run(Thread.java:595)
This looks like a bug, because the managed persistence context says that the contexts will already be destroyed by this point.
public class ManagedPersistenceContext ... public void afterCompletion(int status) { synchronizationRegistered = false; //if ( !Contexts.isConversationContextActive() ) if (destroyed) { //in calls to MDBs and remote calls to SBs, the //transaction doesn't commit until after contexts //are destroyed, so wait until the transaction //completes before closing the session //on the other hand, if we still have an active //conversation context, leave it open close(); } }
However, on close it immediately tries to get the Transaction from the event scope and fails.
public class Transaction { public static UserTransaction instance() { return (UserTransaction) Component.getInstance(Transaction.class, ScopeType.EVENT); }
Am I doing something wrong or is this a bug?