2 Replies Latest reply on Apr 20, 2015 7:15 PM by abajwa

    Transaction handling between two remote jboss eap 6.2 servers

    abajwa

      All,

       

      I need to know whether starting a transaction on node1 and then doing work on node 2 with remote ejb calls from node 1 wrapped under a UserTransaction is possible or not. As of now What Im seeing is below.

       

      Below is the use case Im testing.

       

      1) CMT on an EJB hosted on server1(jboss eap 62)

       

      2) Samplw WebApp deployed on server2  with a servlet doing remote lookup on server1 and executing the remote calls under a transaction and once all work done then commit else rollback

       

      I see the below exception when the commit is fired.

       

      03:02:03,526 INFO  [org.jboss.ejb.client.remoting] (Remoting "config-based-ejb-client-endpoint" task-11) EJBCLIENT000017: Received server version 2 and marshalling strategies [river]

      03:02:03,527 INFO  [org.jboss.ejb.client.remoting] (http-/0.0.0.0:8180-1) EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@200bd4ae, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@68b7fbf1,channel=jboss.ejb,nodename=myjvmserver]} on channel Channel ID aece9cc8 (outbound) of Remoting connection 396b1dd1 to xyz/xx.xx.xx.xx:4447

       

      03:02:24,662 ERROR [stderr] (http-/0.0.0.0:8180-1) java.lang.IllegalStateException: EJBCLIENT000027: No EJBReceiver available for node name myjvmserver

       

      03:02:24,663 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiver(EJBClientContext.java:842)

       

       

      03:02:24,664 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiverContext(EJBClientContext.java:883)

       

       

      03:02:24,665 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.ejb.client.EJBClientUserTransactionContext$UserTransactionImpl.commit(EJBClientUserTransactionContext.java:115)

       

       

      03:02:24,666 ERROR [stderr] (http-/0.0.0.0:8180-1) at com.test.ejb.tx.srvlt.EjbClientSrvlt.doPost(EjbClientSrvlt.java:83)

       

       

      03:02:24,667 ERROR [stderr] (http-/0.0.0.0:8180-1) at com.test.ejb.tx.srvlt.EjbClientSrvlt.doGet(EjbClientSrvlt.java:46)

       

       

      03:02:24,668 ERROR [stderr] (http-/0.0.0.0:8180-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

       

       

      03:02:24,668 ERROR [stderr] (http-/0.0.0.0:8180-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

       

       

      03:02:24,669 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

       

       

      03:02:24,670 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

       

       

      03:02:24,671 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)

       

       

      03:02:24,671 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)

       

       

      03:02:24,672 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)

       

       

      03:02:24,673 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)

       

       

      03:02:24,674 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

       

       

      03:02:24,675 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

       

       

      03:02:24,676 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)

       

       

      03:02:24,676 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)

       

       

      03:02:24,677 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

       

       

      03:02:24,678 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)

       

       

      03:02:24,679 ERROR [stderr] (http-/0.0.0.0:8180-1) at java.lang.Thread.run(Thread.java:745)

       

       

      03:02:24,679 ERROR [stderr] (http-/0.0.0.0:8180-1) java.lang.IllegalStateException: EJBCLIENT000047: A transaction is not associated with this thread

       

       

      03:02:24,680 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.ejb.client.EJBClientUserTransactionContext$UserTransactionImpl.rollback(EJBClientUserTransactionContext.java:151)

       

       

      03:02:24,681 ERROR [stderr] (http-/0.0.0.0:8180-1) at com.test.ejb.tx.srvlt.EjbClientSrvlt.doPost(EjbClientSrvlt.java:95)

       

       

      03:02:24,681 ERROR [stderr] (http-/0.0.0.0:8180-1) at com.test.ejb.tx.srvlt.EjbClientSrvlt.doGet(EjbClientSrvlt.java:46)

       

       

      03:02:24,682 ERROR [stderr] (http-/0.0.0.0:8180-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

       

       

      03:02:24,683 ERROR [stderr] (http-/0.0.0.0:8180-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

       

       

      03:02:24,683 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

       

       

      03:02:24,684 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

       

       

      03:02:24,685 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)

       

       

      03:02:24,685 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)

       

       

      03:02:24,686 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)

       

       

      03:02:24,686 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)

       

       

      03:02:24,687 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

       

       

      03:02:24,687 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

       

       

      03:02:24,688 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)

       

       

      03:02:24,688 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)

       

       

      03:02:24,689 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

       

       

      03:02:24,690 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)

       

       

      03:02:24,691 ERROR [stderr] (http-/0.0.0.0:8180-1) at java.lang.Thread.run(Thread.java:745)

       

       

      03:02:24,691 ERROR [stderr] (http-/0.0.0.0:8180-1) java.lang.IllegalStateException: EJBCLIENT000027: No EJBReceiver available for node name myjvmserver

       

       

      03:02:24,692 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiver(EJBClientContext.java:842)

       

       

      03:02:24,693 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiverContext(EJBClientContext.java:883)

       

       

      03:02:24,693 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.ejb.client.EJBClientUserTransactionContext$UserTransactionImpl.commit(EJBClientUserTransactionContext.java:115)

       

       

      03:02:24,694 ERROR [stderr] (http-/0.0.0.0:8180-1) at com.test.ejb.tx.srvlt.EjbClientSrvlt.doPost(EjbClientSrvlt.java:83)

       

       

      03:02:24,694 ERROR [stderr] (http-/0.0.0.0:8180-1) at com.test.ejb.tx.srvlt.EjbClientSrvlt.doGet(EjbClientSrvlt.java:46)

       

       

      03:02:24,695 ERROR [stderr] (http-/0.0.0.0:8180-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

       

       

      03:02:24,696 ERROR [stderr] (http-/0.0.0.0:8180-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

       

       

      03:02:24,696 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

       

       

      03:02:24,697 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

       

       

      03:02:24,697 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)

       

       

      03:02:24,698 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)

       

       

      03:02:24,698 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)

       

       

      03:02:24,699 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)

       

       

      03:02:24,700 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

       

       

      03:02:24,700 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

       

       

      03:02:24,701 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)

       

       

      03:02:24,702 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)

       

       

      03:02:24,702 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

       

       

      03:02:24,703 ERROR [stderr] (http-/0.0.0.0:8180-1) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)

       

       

      03:02:24,704 ERROR [stderr] (http-/0.0.0.0:8180-1) at java.lang.Thread.run(Thread.java:745)

       

       

       

       

      Attaching the source project for both, please let me know why is it not able to find the EjbReceiver when the ejbs call goes through fine and executes the remote call.

       

       

       

      Url for testing if you run the app is http://localhost:8180/EjbClientWebApp/EjbClientSrvlt?action=true where action true or false controls the commit or rollback.

       

      Message was edited by: Avneet Bajwa

        • 1. Re: Transaction handling between two remote jboss eap 6.2 servers
          abajwa

          One  observation is that even when hosted on same server the approach of EjbClient.getTransaction doesnot work , then when i do the lookup of the transaction object old way through jndi, it works on same server but the actual use case fails when we move again to remote servers.

           

              //ut = EJBClient.getUserTransaction("myjvmserver");

               ut = (UserTransaction) ctx.lookup("java:jboss/UserTransaction");

           

          In jboss 5 i had to enable JTS for this to work and now even with JTS enabled i am not able to get this working.

           

          Would appreciate some help on this.

          • 2. Re: Transaction handling between two remote jboss eap 6.2 servers
            abajwa

            Got this working without JTS but looks like Ejb Security is a requirement without which the transaction propagation does not work, had to make the ejb mandatory to confirm transaction propagation was not happening, then went on to enable the security based on the knowledge base articles and got the transactions to get propagated.

             

            Can any one please confirm my findings that security is a must when talking about transactions between two remote servers, its not new as weblogic too enforces intra domain security for this to work but need to be sure before finalizing the solution.

             

            Also I used the client configuration of

            Configuring remote servers in the JBoss profile

             

            Can some also please point to how we can do this for a cluster for faiover.