2 Replies Latest reply on Apr 14, 2008 6:26 PM by Robin Young

    Asynchronous from non-seam start point

    Robin Young Newbie

      I can get @Asynchronous working fine in 'normal' situations however I have difficulty with the following:-


      I would like to be able to asynchronously perform an action (writing to cvs) during a method annotated with @PrePersist in an entity.


      I have a stateless session bean that is also a seam component that has the method marked with @Asynchronous.
      If I get the component using Component.getInstance() I can run the method but it doesn't run asynchronously.
      If I get the component using Context.lookup() then I can again run the method but again it doesn't run asynchronously. However if I @In the component elsewhere the method will run asynchronously.


      Is there a way to get at a component that is initialized significantly enough without using @In so that I can use it in an @PrePersist on an entity?

        • 1. Re: Asynchronous from non-seam start point
          Pete Muir Master

          It should run asynchronously, can you post the call stack inside the asynchronously run method?

          • 2. Re: Asynchronous from non-seam start point
            Robin Young Newbie

            17:19:52,373 ERROR [STDERR] java.lang.Exception: Stack trace
            17:19:52,374 ERROR [STDERR]     at java.lang.Thread.dumpStack(Thread.java:1158)
            17:19:52,374 ERROR [STDERR]     at com.canopyasp.canopynet.os.service.CvsWriterImpl.asyncWriteToCvs(CvsWriterImpl.java:41)
            17:19:52,374 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            17:19:52,374 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            17:19:52,374 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            17:19:52,374 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:585)
            17:19:52,374 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
            17:19:52,374 ERROR [STDERR]     at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
            17:19:52,374 ERROR [STDERR]     at com.canopyasp.canopynet.os.entity.Detacher.detach(Detacher.java:54)
            17:19:52,375 ERROR [STDERR]     at sun.reflect.GeneratedMethodAccessor172.invoke(Unknown Source)
            17:19:52,375 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            17:19:52,375 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:585)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:49)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
            17:19:52,375 ERROR [STDERR]     at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
            17:19:52,375 ERROR [STDERR]     at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
            17:19:52,375 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            17:19:52,375 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:585)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
            17:19:52,375 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            17:19:52,375 ERROR [STDERR]     at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:240)
            17:19:52,376 ERROR [STDERR]     at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
            17:19:52,376 ERROR [STDERR]     at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
            17:19:52,376 ERROR [STDERR]     at $Proxy203.asyncWriteToCvs(Unknown Source)
            17:19:52,376 ERROR [STDERR]     at com.canopyasp.canopynet.os.CvsFaceletEntityListener.doPreTarget(CvsFaceletEntityListener.java:138)