0 Replies Latest reply on Sep 29, 2016 6:18 AM by vinaytadvi83

    Exception calling component @Destroy method: pricingRMSEm: java.lang.IllegalStateException: attempting to destroy the persistence context while an active transaction exists (try installing <transaction:ejb-transaction/>)

    vinaytadvi83

      We are doing application migration from JBoss 5 to Jboss 7.1.1 Final. Application uses Seam 2.1.2, Hibernate 3.3 and was developed to run on JBoss 5. While doing migration, all migration steps were followed. Application deployed successfully. While processing data, we are facing error related to Seam managed Persistence Context.

       

      Exception calling component @Destroy method: pricingRMSEm:

      java.lang.IllegalStateException: attempting to destroy the persistence context

      while an active transaction exists (try installing

      <transaction:ejb-transaction/>)

       

      Application does asynchronous processing on data and this processes are trying to do activity in new transaction always. Transaction is handled manually through code.

      (i.e. manually commit existing one and start new transaction, when ever TransactionalInvoker.doInNewTransaction() method called). With TRACE level log we can see that Seam tries to destroy Persistence Context even when there is active transaction. Which is causing application fail processing.

       

      Server Log:

       

      00:29:53,442 DEBUG [org.jboss.seam.transaction.UTTransaction] (EJB default - 1) beginning JTA transaction

      00:29:53,444 TRACE [org.jboss.seam.intercept.RootInterceptor] (EJB default - 1) not intercepted: org.jboss.seam.transaction.synchronizations.afterTransactionBegin

      00:29:53,447 DEBUG [org.jboss.seam.transaction.EjbSynchronizations] (EJB default - 1) afterBegin

      00:29:53,450 TRACE [org.jboss.seam.Component] (EJB default - 1) outjecting dependencies of: transactionalInvoker

      00:29:53,451 TRACE [org.jboss.seam.Component] (EJB default - 1) disinjecting dependencies of: transactionalInvoker

      00:29:53,453 TRACE [org.jboss.seam.Component] (EJB default - 1) outjecting dependencies of: pricingLockService

      00:29:53,455 TRACE [org.jboss.seam.Component] (EJB default - 1) disinjecting dependencies of: pricingLockService

      00:29:53,457 INFO  [com.agcs.pricing.util.vartrc.TracerHelper] (EJB default - 1) writing 1 tracers of threadcontext EJB default - 1

      00:29:53,460 TRACE [org.jboss.seam.Component] (EJB default - 1) outjecting dependencies of: asyncRmsPricingStarter

      00:29:53,462 TRACE [org.jboss.seam.Component] (EJB default - 1) disinjecting dependencies of: asyncRmsPricingStarter

      00:29:53,464 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.preRemoveVariable.org.jboss.seam.async.AsynchronousIntercepter.REENTRANT

      00:29:53,467 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.postRemoveVariable.org.jboss.seam.async.AsynchronousIntercepter.REENTRANT

      00:29:53,469 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.preRemoveVariable.org.jboss.seam.core.executingAsynchronousCall

      00:29:53,472 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.postRemoveVariable.org.jboss.seam.core.executingAsynchronousCall

      00:29:53,474 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.preDestroyContext.SESSION

      00:29:53,476 DEBUG [org.jboss.seam.contexts.Contexts] (EJB default - 1) destroying: org.jboss.seam.international.localeSelector

      00:29:53,479 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.preDestroy.org.jboss.seam.international.localeSelector

      00:29:53,482 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.postDestroyContext.SESSION

      00:29:53,484 DEBUG [org.jboss.seam.contexts.Contexts] (EJB default - 1) destroying business process context

      00:29:53,486 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.preDestroyContext.BUSINESS_PROCESS

      00:29:53,488 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.postDestroyContext.BUSINESS_PROCESS

      00:29:53,490 DEBUG [org.jboss.seam.contexts.Contexts] (EJB default - 1) destroying conversation context

      00:29:53,492 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.preDestroyContext.CONVERSATION

      00:29:53,494 DEBUG [org.jboss.seam.contexts.Contexts] (EJB default - 1) destroying: org.jboss.seam.persistence.persistenceContexts

      00:29:53,496 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.preDestroy.org.jboss.seam.persistence.persistenceContexts

      00:29:53,498 DEBUG [org.jboss.seam.contexts.Contexts] (EJB default - 1) destroying: pricingEm

      00:29:53,500 TRACE [org.jboss.seam.core.Events] (EJB default - 1) Processing event:org.jboss.seam.preDestroy.pricingEm

      00:29:53,502 WARN  [org.jboss.seam.Component] (EJB default - 1) Exception calling component @Destroy method: pricingEm: java.lang.IllegalStateException: attempting to destroy the persistence context while an active transaction exists (try installing <transaction:ejb-transaction/>)

      at org.jboss.seam.persistence.ManagedPersistenceContext.close(ManagedPersistenceContext.java:214) [jboss-seam.jar:2.1.2]

      at org.jboss.seam.persistence.ManagedPersistenceContext.destroy(ManagedPersistenceContext.java:177) [jboss-seam.jar:2.1.2]

       

      Please see attached component.xml, persistence.xml, web.xml and TransactionalInvoker for detail.

       

      This issue has blocked our migration work. Any help is very much appreciated.