4 Replies Latest reply on Nov 29, 2013 2:00 PM by AAYUSH SINGHAL

    How to resolve UserTransaction from another JBoss server in JBoss 5.1




      I have a 3rd party tool (EJB 2.0) deployed on remote JBoss 5.1.  I have to use these EJBs using the client code (a plain servlet deployed on my local machine's JBoss 5.1) somewhat like this :


      IntitialContext context = new initialContext(RemoteServerEnv.prop);

      UserTransaction ut = (UserTransaction)context.lookup("UserTransaction");










      The above code works fine when written in a POJO client (inside a plain main() method). The transaction (the changes made by MethodOnEJB1 and 2) gets rolled back in case of 'errorFound' being true.


      However, the same code does not rollback the transaction when I run it from my client web-app which is also deployed on JBoss 5.1 (local server on my machine, not the same as the remote server where EJBs are deployed).


      The difference that I found out between the 2 codes is that

      1. in POJO client, the InitialContext.lookup("UserTransaction") returns an instance of ClientUserTransaction while

      2. in JBoss client, the InitialContext.lookup("UserTransaction"); returns an instance of ServerVMClientUserTransaction.


      I am unable to understand why am I getting ServerVMClientUserTransaction instead of ClientUSerTransaction. I am looking up the remote server but it is returning me the UserTransaction from my local server (cause ServerVMClientUserTransaction is returned when looking up "UserTransaction" on the same JVM)


      Is there any way that I can resolve this....


      Many thanks.


      Message was edited by: AAYUSH SINGHAL