Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jboss 7.1 ejb 2.1 custom transaction timeout configuration

I'm currently trying to upgrade my web application from jboss 5.1 to jboss 7.1.1.Final

In my jboss.xml I have configured some custom ejb timeouts like the following:

     <session>
        <ejb-name>MSServiceEJB</ejb-name>
        <jndi-name>ejb/MSServiceEJB</jndi-name>
        <local-jndi-name>ejb/LocalMSServiceEJB</local-jndi-name>
        <method-attributes>
            <method>
                <method-name>*</method-name>
                <transaction-timeout>3600</transaction-timeout>
            </method>
        </method-attributes>
    </session>

jboss 7 ignores jboss.xml, where can I specify my ejb 2.1 transaction timeouts?

like image 906
mobile Avatar asked Oct 22 '12 16:10

mobile


2 Answers

Per

Source

Replace the jboss.xml deployment descriptor file

The jboss-ejb3.xml deployment descriptor replaces the jboss.xml deployment descriptor to override and add to the features provided by the Java Enterprise Edition (EE) defined ejb3-jar.xml deployment descriptor. The new file is incompatible with jboss.xml, and the jboss.xml is now ignored in deployments.

You need to create a jboss-ejb3.xml and put the configuration inside it.

It would look something like this:

<assembly-descriptor>
    <container-transaction>
        <method>
            <ejb-name>EJBName</ejb-name>
            <method-name>methodName</method-name>
            <method-intf>Local</method-intf>
        </method>
        <tx:trans-timeout>
            <tx:timeout>500</tx:timeout>
            <tx:unit>Seconds</tx:unit>
        </tx:trans-timeout>
    </container-transaction>
</assembly-descriptor>

You are using EJB2.x , so it would be better and wise to configure it in ejb-jar.xml

It should be created in META-INF of the EJB jar.

like image 108
Mukul Goel Avatar answered Nov 08 '22 08:11

Mukul Goel


You can specify on the Bean method with @TransactionTimeOut annotation.

@TransactionTimeout(value = 10, unit = TimeUnit.SECONDS)

For detailed description of how to set, please refer here

Maddy

like image 43
Maddy Avatar answered Nov 08 '22 06:11

Maddy