0 Replies Latest reply on Dec 30, 2008 9:26 PM by Christian Gruber

    Is tx propagation to remote ejb 3.0 still not working?

    Christian Gruber Newbie

      Hello,
      I tried to test a distributed transaction between two JBoss AS 5.0.0, but the expected propagation of the transaction context didn't occur. The behaviour is equal to 4.2.2.
      Or can there be any other problem?
      Here is my code (the second method is called on the second remote server):

      @TransactionAttribute(TransactionAttributeType.REQUIRED)
       public List<TestTable> getTestTableEntriesFromServer() {
       System.out.println("connect to other remote EJB...");
       try {
       List<TestTable> entries = ConnectToServer.getInstance().getServerHandler().getTestTableEntriesFromCentralServer();
       } catch (Exception e) {
       System.out.println(e.getMessage());
       e.printStackTrace();
       }
       System.out.println("Throw exception...");
       throw new IllegalStateException("I want to terminate the transaction!");
       }
      
       @TransactionAttribute(TransactionAttributeType.MANDATORY)
       public List<TestTable> getTestTableEntriesFromCentralServer() {
       List<TestTable> entries = null;
       //central server
       entries = testTableDAO.findAll();
       for (TestTable entry : entries) {
       entry.setName(entry.getName() + "->LS");
       }
       System.out.println("Server gets [" + entries.size() + "] testTable entries.");
       return entries;
       }


      From my understanding of EJB 3.0 the transaction starts with the first Method call getTestTableEntriesFromServer and should propagate to the call of getTestTableEntriesFromCentralServer, so that MANDATORY of the second method would be fulfilled.

      The second server doesn't get the Transaction context. This is the beginning of the stacktrace.

      03:15:52,546 ERROR [STDERR] javax.ejb.EJBTransactionRequiredException: public java.util.List de.connectodent.server.bean
      s.ServerHandlerBean.getTestTableEntriesFromCentralServer()
      03:15:52,546 ERROR [STDERR] at org.jboss.ejb3.tx.Ejb3TxPolicy.throwMandatory(Ejb3TxPolicy.java:47)
      03:15:52,546 ERROR [STDERR] at org.jboss.ejb3.tx.TxInterceptor$Mandatory.invoke(TxInterceptor.java:141)
      03:15:52,546 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      03:15:52,546 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:67
      )
      03:15:52,546 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)


      The discussion why it was not working in 4.x is here:
      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=122025[/url]

      Any help is appreciated!
      Christian