1 Reply Latest reply on Apr 25, 2007 6:46 AM by Pete Muir

    Seam question...and problem

    Stateless Bean Novice

      Hi all,
      Can anyone tell me is my doing right?
      I want to have one global for all user sessions collection, and each user can insert to those collection some date of excecute.
      I also got asynchronous invoked method that get time of excecution from collection and invoke my method.
      Method do somethink in db.

      And here is my code:

      Here is my class:

      @Name("engineControler")
      public class EngineControler extends MySystem {
      


      1. can I inject my EntityManager to application context right that?
      @In(create=true)
      protected EntityManager em;
      


      I got some trouble with method with is invoke.
      Normally method working well, but in timmer i get
      11:11:29,866 WARN [Contexts] Could not destroy component: em
      org.hibernate.TransactionException: Could not register synchronization
       at org.hibernate.transaction.CMTTransaction.registerSynchronization(CMTTransaction.java:159)
       at org.hibernate.ejb.EntityManagerImpl.close(EntityManagerImpl.java:59)
       at org.jboss.seam.core.ManagedPersistenceContext.destroy(ManagedPersistenceContext.java:145)
       at sun.reflect.GeneratedMethodAccessor520.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:102)
       at org.jboss.seam.Component.callComponentMethod(Component.java:1835)
       at org.jboss.seam.Component.callDestroyMethod(Component.java:1791)
       at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:230)
       at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:396)
       at org.jboss.seam.contexts.Lifecycle.endCall(Lifecycle.java:72)
       at org.jboss.seam.core.Dispatcher$Asynchronous.execute(Dispatcher.java:94)
       at org.jboss.seam.core.Dispatcher.dispatch(Dispatcher.java:165)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.callTimeout(StatelessContainer.java:124)
       at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:524)
       at java.util.TimerThread.mainLoop(Unknown Source)
       at java.util.TimerThread.run(Unknown Source)
      Caused by: javax.transaction.RollbackException: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=sherkan/73, BranchQual=, localId=73]
       at org.jboss.tm.TransactionImpl.registerSynchronization(TransactionImpl.java:635)
       at org.hibernate.transaction.CMTTransaction.registerSynchronization(CMTTransaction.java:156)
       ... 43 more
      11:11:29,906 ERROR [TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBException: java.lang.NullPointerException