JBOSS 7.1 EJB 2.1自定义事务超时配置



我目前正在尝试将我的Web应用程序从JBOSS 5.1升级到JBOSS 7.1.1. -final

在我的jboss.xml中,我配置了一些自定义EJB超时时间:

     <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忽略jboss.xml,我可以在哪里指定我的EJB 2.1事务超时?

per

来源

替换jboss.xml部署描述符文件

jboss-ejb3.xml部署描述符将jboss.xml部署描述符替换为 覆盖并添加Java Enterprise提供的功能 版本(EE)定义的EJB3-JAR.xml部署描述符。新文件 与jboss.xml不兼容,现在忽略了jboss.xml 部署。

您需要创建jboss-ejb3.xml并将配置放入其中。

看起来像这样:

<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>

您正在使用EJB2.x,因此在ejb-jar.xml

中配置它是更好的选择

应该在META-INF of the EJB jar中创建它。

您可以使用@transactionTimeOut注释在BEAN方法上指定。

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

有关如何设置的详细说明,请参阅此处

Maddy

最新更新