2 Replies Latest reply on Jan 26, 2011 10:01 AM by markboletti

    Executing EJB Processor calls in a tx

    markboletti

      Hi all,

      we have some Stateless EJBs that execute Statements on the DB. Now we would need to deliver the EJB as service on the JBoss ESB.

      The matter is that EJB Processor calls should run within a JTA transaction so that commit is issued at the end.

      For example, I have configured the following chain of actions:

       

        <actions mep="OneWay">

       

                                              <action name="EJBTestVoid" class="org.jboss.soa.esb.actions.EJBProcessor">

                                                        <property name="ejb3" value="true" />

                                                        <property name="method" value="executeStatement1" />

                                                        <property name="jndi-name" value="SimpleSLSB/remote" />

                                                        <property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory" />

                                                        <property name="provider-url" value="localhost:1099" />

                                                        <property name="ejb-params">

                                                                  <arg0 type="java.lang.String">org.jboss.soa.esb.message.defaultEntry</arg0>

                                                        </property>

                                              </action>

       

       

                          <action name="EJBTestVoid" class="org.jboss.soa.esb.actions.EJBProcessor">

                             <property name="ejb3" value="true" />

                             <property name="method" value="executeStatement2" />

                             <property name="jndi-name" value="SimpleSLSB/remote" />

                             <property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory" />

                             <property name="provider-url" value="localhost:1099" />

                             <property name="ejb-params">

                             <arg0 type="java.lang.String">org.jboss.soa.esb.message.defaultEntry</arg0>

                             </property>

                           </action>

       

        </actions>

       

      However I can see that if an Exception is raised in executeStatement2 (and setRollBackOnly) is called, no tx rollback is invoked but merely a Warning is reported on the Console:

       

      12:17:35,171 WARN  [ActionProcessingPipeline] No fault address defined for fault  message! To: JMSEpr [ PortReference < <wsa:Address jms:127.0.0.1:1099#queue/quickstart_ejbprocessor_Request_esb/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.initial : org.jnp.interfaces.NamingContextFactory/>, <wsa:ReferenceProperties jbossesb:java.naming.provider.url : 127.0.0.1:1099/>, <wsa:ReferenceProp

      erties jbossesb:java.naming.factory.url.pkgs : org.jnp.interfaces/>, <wsa:ReferenceProperties jbossesb:destination-type : queue/>, <wsa:ReferenceProperties jbossesb:destination-name : queue/quickstart_ejbprocessor_Request_esb/>, <wsa:ReferenceProperties jbossesb:specification-version : 1.1/>, <wsa:ReferenceProperties jbossesb:connection-factory : ConnectionFactory/>, <wsa:ReferenceProperties jbossesb:persistent : true/>, <wsa:ReferenceProperties jbossesb:acknowledge-mode : AU

      TO_ACKNOWLEDGE/>, <wsa:ReferenceProperties jbossesb:transacted : false/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/jms/> > ] MessageID: e5cc066f-1883-447a-ab2a-e9f5e47b2992 RelatesTo: jms:correlationID#e5cc066f-1883-4

      47a-ab2a-e9f5e47b2992

       

      Is there a way to for the two EJB calls to join a single JTA transaction ? Thank you very much

      Mark