1 Reply Latest reply on Dec 13, 2007 5:22 PM by Mark Little

    Spring - JBoss : Transaction propagation

    Sylvain Mougenot Newbie

      Using :
      JBoss 3.2.3
      Spring 2.0.6

      I'm trying to re-use some business logic contained in an EJB hosted on a JBoss AS from an application running on another server (Tomcat) using Spring.
      I also need to propagate the transaction initialised in Spring (because of ACID needs) : If the Spring application Rollback, the EJB must Rollback what was done (and vice-versa).

      It looks like the EJB can be retrieved on a JNDI call (not surprising).
      But TransactionManager could not.

      The error is TransactionManager can't be retrieved :
      javax.naming.NameNotFoundException: TransactionManager not bound
      But through the JMX-console I could find it with this jndi name.

      jndi.properties

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=localhost
      


      Should I do something special on JBoss to allow TransactionManager to be retrieved?
      Is there something missing with in the configuration?
      Is it necessary to have access to the Transaction Manager (the EJB is a CMT so I guess the answer is "yes")?


      Here are parts of the config files.
      Spring
       <util:properties id="jndiPropsSwing" location="classpath:jndi.properties"/>
      
       <jee:jndi-lookup id="containerTX" jndi-name="java:/TransactionManager" environment-ref="jndiPropsSwing"/>
      
       <!-- Gestionnaire de transaction JTA -->
       <bean id="transactionManager"
       class="org.springframework.transaction.jta.JtaTran sactionManager">
       <property name="transactionManager">
       <ref local="containerTX" />
       </property>
       <property name="userTransactionName">
       <value>UserTransaction</value>
       </property>
       </bean>
      
       <!-- EJB Swing -->
       <jee:remote-slsb id="myReception"
       business-interface="...ReceptionFacade"
       jndi-name="ejb/ReceptionFacade"
       environment-ref="jndiPropsSwing"
       />
      


      Thank you for your attention
      Sylvain

        • 1. Re: Spring - JBoss : Transaction propagation
          Mark Little Master

           

          "smougenot" wrote:
          Using :
          JBoss 3.2.3
          Spring 2.0.6

          I'm trying to re-use some business logic contained in an EJB hosted on a JBoss AS from an application running on another server (Tomcat) using Spring.
          I also need to propagate the transaction initialised in Spring (because of ACID needs) : If the Spring application Rollback, the EJB must Rollback what was done (and vice-versa).


          Hello again ;-)

          If you want to flow transaction contexts between processes then you need to either use a standard such as JTS or Web Services Transactions, or make sure that both processes are running the same transaction manager (and that transaction manager supports distributed transactions). If you deploy JBossTS into Spring as well as JBossAS, then this is possible. Otherwise, your options are extremely limited.