2 Replies Latest reply on Feb 20, 2008 10:00 PM by System Administrator

    Asynchronous and could not enlist in transaction

    System Administrator Expert

      ok so this may be another case of you need to use XA datasource for 2PC with these distributed transactions and multiple resource managers.


      I am doing a POC for the EJB3 timer and quartz functionality in conjunction with @org.jboss.seam.annotations.async.Asynchronous as per section 18.1. Asynchronicity of Seam doc.


      Long story short, we're not using XA/2PC here (yet) and I had to annotate the client SFSB calling method with


      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)



      as well as the timer scheduler/processor SLSB with the same annotation (in that case I did it at the class level but it won't matter since there is only one method in that SLSB) to fix/bypass the NestedSQLException.  Using the annotation above only on the SLSB method did not fix it.  I had to apply

      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

      to both methods essentially.


      What is the best way to workaround this problem?  I've seen this crop up several times now and it seems to happen whenever there is more than one resource manager required in a (thus distributed) transaction...


      client (SFSB) code:


      @Stateful
      
      @Name("paymentAction")
      
      public class CreatePaymentAction implements CreatePaymentLocal {
      
           
      
           @In(create=true) PaymentHandler paymentHandler;
      
           
      
           private Date today = new Date(); 
      
           
      
           @In(create = true)
      
           private CustomerLocalDAO customerDAO;
      
           
      
           private Integer customerId;
      
           
      
           private Integer paymentId;
      
           
      
           @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
      
           public String schedulePayment() {
      
                
      
                Customer customer = customerDAO.getById(customerId);
      
                
      
                Payment payment = new Payment(paymentId, customer);
      
                
      
                Timer timer = paymentHandler.processScheduledPayment( payment, today );
      
                return "success";
      
           }
      
           
      
           public void setCustomerId(Integer customerId) {
      
                this.customerId = customerId;
      
           }
      
           
      
           public Integer getCustomerId() {
      
                return customerId;
      
           }
      
           
      
           public void setPaymentId(Integer paymentId) {
      
                this.paymentId = paymentId;
      
           }
      
           
      
           public Integer getPaymentId() {
      
                return paymentId;
      
           }
      
           
      
           @Remove @Destroy     
      
           public void destroy(){}
      
      }
      
      



      processor (SLSB) code:


      @Stateless
      
      @Name("paymentHandler")
      
      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
      
      public class PaymentHandlerBean implements PaymentHandler {
      
           
      
           @In Timer timer;
      
           
      
           @Logger
      
           private Log log;
      
           
      
           
      
           public Timer processScheduledPayment(Payment payment, @Expiration Date date) {
      
                //do some work!
      
                log.info("in processScheduledPayment");
      
                return timer; //note that return value is completely ignored
      
           }
      
           
      
      }



      SLSB local interface:


      @Local
      
      public interface PaymentHandler {
      
                
      
           @Asynchronous
      
           public Timer processScheduledPayment(Payment payment, @Expiration Date date);
      
                
      
      }



      stack trace:


      13:47:08,770 WARN  [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] Adding multiple last resources is disallowed. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@8ee94b
      
      13:47:08,786 ERROR [TimerServiceImpl] Cannot create txtimer
      
      java.lang.IllegalStateException: Unable to persist timer
      
           at org.jboss.ejb.txtimer.DatabasePersistencePolicy.insertTimer(DatabasePersistencePolicy.java:124)
      
           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.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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      
           at $Proxy30.insertTimer(Unknown Source)
      
           at org.jboss.ejb.txtimer.TimerServiceImpl.createTimer(TimerServiceImpl.java:256)
      
           at org.jboss.ejb.txtimer.TimerServiceImpl.createTimer(TimerServiceImpl.java:222)
      
           at org.jboss.ejb3.timerservice.jboss.TimerServiceFacade.createTimer(TimerServiceFacade.java:61)
      
           at org.jboss.seam.async.TimerServiceDispatcher.scheduleWithTimerService(TimerServiceDispatcher.java:88)
      
           at org.jboss.seam.async.TimerServiceDispatcher.scheduleInvocation(TimerServiceDispatcher.java:65)
      
           at org.jboss.seam.async.TimerServiceDispatcher.scheduleInvocation(TimerServiceDispatcher.java:37)
      
           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.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      
           at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      
           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.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      
           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.invokeInCallerTx(TxPolicy.java:126)
      
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      
           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:77)
      
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      
           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.localInvoke(StatelessContainer.java:214)
      
           at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184)
      
           at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
      
           at $Proxy118.scheduleInvocation(Unknown Source)
      
           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.seam.util.Reflections.invoke(Reflections.java:21)
      
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      
           at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      
           at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
      
           at org.javassist.tmp.java.lang.Object_$$_javassist_6.scheduleInvocation(Object_$$_javassist_6.java)
      
           at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:38)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      
           at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
      
           at org.javassist.tmp.java.lang.Object_$$_javassist_4.processScheduledPayment(Object_$$_javassist_4.java)
      
           at com.cox.ejb.session.CreatePaymentAction.schedulePayment(CreatePaymentAction.java:38)
      
           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.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      
           at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      
           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.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      
           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.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
      
           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.invokeInCallerTx(TxPolicy.java:126)
      
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      
           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.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      
           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.stateful.StatefulContainer.localInvoke(StatefulContainer.java:204)
      
           at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
      
           at $Proxy108.schedulePayment(Unknown Source)
      
           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.seam.util.Reflections.invoke(Reflections.java:21)
      
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      
           at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      
           at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
      
           at org.javassist.tmp.java.lang.Object_$$_javassist_3.schedulePayment(Object_$$_javassist_3.java)
      
           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.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
      
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
      
           at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
      
           at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
      
           at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
      
           at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
      
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
      
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
      
           at javax.faces.component.UICommand.broadcast(UICommand.java:383)
      
           at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
      
           at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
      
           at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
      
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
      
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:118)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
      
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
      
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
      
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      
           at java.lang.Thread.run(Unknown Source)
      
      Caused by: org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: a2e0582:d6e:47bb4dca:4b status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: a2e0582:d6e:47bb4dca:4b status: ActionStatus.ABORT_ONLY >))
      
           at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
      
           at org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin.insertTimer(GeneralPurposeDatabasePersistencePlugin.java:199)
      
           at org.jboss.ejb.txtimer.DatabasePersistencePolicy.insertTimer(DatabasePersistencePolicy.java:120)
      
           ... 206 more
      
      Caused by: org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: a2e0582:d6e:47bb4dca:4b status: ActionStatus.ABORT_ONLY >)
      
           at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:343)
      
           at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(BaseConnectionManager2.java:518)
      
           at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:399)
      
           at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
      
           at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
      
           ... 208 more
      
      Caused by: javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: a2e0582:d6e:47bb4dca:4b status: ActionStatus.ABORT_ONLY >
      
           at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TransactionSynchronization.checkEnlisted(TxConnectionManager.java:744)
      
           at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:577)
      
           at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:337)
      
           ... 212 more
      
      


        • 1. Re: Asynchronous and could not enlist in transaction
          System Administrator Expert

          In comparison, the seampay example is using two POJO classes (i.e. non-EJB classes): PaymentController and PaymentProcessor and thus will not have this problem since CMT is not relevant...

          • 2. Re: Asynchronous and could not enlist in transaction
            System Administrator Expert

            After some experimentation with the seam-pay example app, I was able to reproduce another problem I had today (not related to distributed flat transactions as previously reported). 
            Stack trace below:


            2008-02-20 09:24:53,846 ERROR [org.jboss.ejb.txtimer.TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBException: java.lang.NullPointerException
            
            2008-02-20 09:24:53,846 DEBUG [org.jboss.ejb.txtimer.TimerImpl] Timer was not registered with Tx, resetting state: [id=1,target=[target=jboss.j2ee:service=EJB3,ear=SecurityAuditPOC.ear,jar=jboss-seam.jar,name=TimerServiceDispatcher],remaining=-33893846,periode=0,in_timeout]
            
            2008-02-20 09:24:53,846 DEBUG [org.jboss.ejb.txtimer.TimerImpl] setTimerState: expired
            
            2008-02-20 09:24:53,846 DEBUG [org.jboss.ejb.txtimer.TimerImpl] killTimer: [id=1,target=[target=jboss.j2ee:service=EJB3,ear=SecurityAuditPOC.ear,jar=jboss-seam.jar,name=TimerServiceDispatcher],remaining=-33893846,periode=0,expired]



            This happened when I removed the @Transactional annotation in the following code in the PaymentProcessor POJO of the seam-pay app:


               @Asynchronous
            
                //AS 02-20-08 commenting transactional annotation below...
            
                //@Transactional
            
                public Timer schedulePayment(@Expiration Date when, 
            
                                             @IntervalDuration Long interval, 
            
                                             Payment payment) 
            
                { 
            
                    payment = entityManager.merge(payment);
            
            
                    log.info("[#0] Processing payment #1", System.currentTimeMillis(), payment.getId());
            
                    processPayment(payment);
            
            
                    return null;
            
                }



            Refer to 18.2.5 of the JSR220 (ejbcore) for more regarding EJB timers and transaction requirements.  If a transaction is always required with EJB timer API work, then my solution from yesterday may not work…