Jboss 7.1 ejb 2.1 custom transaction timeout configuration
Asked Answered
D

2

8

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?

Downwash answered 22/10, 2012 at 16:3 Comment(0)
I
7

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.

Isham answered 17/11, 2012 at 14:56 Comment(1)
If anyone is asking himself which xlmns to set for tx: it is "urn:trans-timeout" (described here)Lapides
C
3

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

Cannibal answered 23/10, 2012 at 10:48 Comment(1)
This is for EJB 3, not EJB 2.Calamitous

© 2022 - 2024 — McMap. All rights reserved.