3 Replies Latest reply on Jun 11, 2007 11:15 AM by jhalliday

    Transaction not propagated

    clovisleoncio

      I'm using JBoss 4.2.0 and have the following beans:

      @Stateless
      @Local(ParteBo.class)
      public class ParteBoImpl implements ParteBo {
      
       @PersistenceContext
       private EntityManager entityManager;
      
       public EntityManager getEntityManager() {
       return entityManager;
       }
       public void setEntityManager(EntityManager entityManager) {
       this.entityManager = entityManager;
       }
      
       @TransactionAttribute(value = TransactionAttributeType.REQUIRED)
       public void save(Parte parte, boolean sucess) {
       getPessoaBo().save(parte.getPessoa());
       getEntityManager().persist(parte);
       if (!sucess) {
       throw new RuntimeException("Force rollback");
       }
       }
      
       private PessoaBo getPessoaBo() {
       try {
       Context context = new InitialContext();
       return (PessoaBo) context.lookup("jnp://172.16.4.94:1099/PessoaBoImpl/remote");
       } catch (NamingException e) {
       e.printStackTrace();
       }
       return null;
       }
      }
      
      


      @Stateless
      @Remote(PessoaBo.class)
      public class PessoaBoImpl implements PessoaBo {
      
       @PersistenceContext
       private EntityManager entityManager;
      
       public EntityManager getEntityManager() {
       return entityManager;
       }
       public void setEntityManager(EntityManager entityManager) {
       this.entityManager = entityManager;
       }
      
       @TransactionAttribute(value = TransactionAttributeType.MANDATORY)
       public Pessoa save(Pessoa pessoa) {
       getEntityManager().persist(pessoa);
       return pessoa;
       }
      }
      


      And I've changed jbossjta-properties.xml:

       <property name="com.arjuna.ats.jta.jtaTMImplementation" value="com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple"/>
       <property name="com.arjuna.ats.jta.jtaUTImplementation" value="com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple"/>
      


      The transaction is not propagating. Any ideas?

      (Sorry abou my english)

        • 1. Re: Transaction not propagated
          marklittle

          If you are after propagation between VM instances then you need to either use JTS (also supports JTA) or Web Services transactions. The default JTA implementation is purely local, i.e., within a single VM.

          • 2. Re: Transaction not propagated
            clovisleoncio

            But I've changed jbossjta-properties.xml to this:

            <property name="com.arjuna.ats.jta.jtaTMImplementation" value="com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple"/>
            <property name="com.arjuna.ats.jta.jtaUTImplementation" value="com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple"/>
            


            Anything else I have to do to use Transactions as JTA?

            • 3. Re: Transaction not propagated
              jhalliday

              I assume you mean "Transactions as JTS" since the JTA is the default in 4.2 and thus you don't need to do any changes for JTA.

              For JTS: Have you actually installed the JTS? It does not ship with AS 4.2. It's not even guaranteed to work on AS 4.2 at the moment, but you won't know for sure until you download it and try it. The integration procedure is not documented yet, but take a look at the installation notes for adding JTS to previous versions of JBossAS, they will probably provide some useful direction.