How can I increase JTA transaction timeout in WildFly?
Can be updated in standalone.xml
as well as from Admin Console right?
It is recommended that you set the 1Transact timeout value to be at least 600 seconds (10 minutes.) To change this setting, connect to WebLogic Server Administration Console. On the Domain > Configuration > JTA >Timeout Seconds tab, modify the Java Transaction API (JTA) timeout to be a minimum of 600.
Transaction timeout in WildFly / JBoss can be configured in the transactions subsystem or at EJB level. When the transaction is configured in the transactions subsystem it will be the default transaction timeout for all JTA transactions.
Default is 300 seconds (5 minutes); minimum is 10 seconds; maximum is 1800 seconds (30 minutes).
Usually, the Wildfly server may get a timeout by 300 seconds (5 minutes) for a transaction. We can change this timeout problem by just adding a small piece of code in the standalone.xml file which will be available in \wildfly-8.0.0.Final\standalone\configuration.
Although specific to some use cases, the occurrence of JTA transaction timeout is not that unusual and can happen in production. Especially, when the amounts of the data drastically increase compared to the limits defined initially. Maybe, you've just also switched to a different application server? In Spring this is a piece of cake.
The value of default-timeout can be configured through the coordinator-environment element as follows: Here is how tou can increase the default transaction timeout with the CLI: Firstly, you can set the transaction timeout for a specific EJB with the @org.jboss.ejb3.annotation.TransactionTimeout annotation:
JTA transaction timeout can be configured globally for WebSphere Application Server Community Edition by modifying the config.xml file. The steps to configure JTA transaction timeout are: Stop the application server if running. Edit the config.xml file located in the following directory: Locate the Transaction Manager module in the config.xml file:
The transaction timeout can also be changed in standalone.xml directly (without using the JBoss Client). Just add this to the transactions subsystem:
<coordinator-environment default-timeout="1800"/>
If you are using Wildfly in standalone, you can use Jboss Client to do this configuration:
[standalone@localhost:9990 /] /subsystem=transactions:write-attribute(name=default-timeout,value=500)
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
If you are using Wildfly in domain mode:
[domain@localhost:9990 /] /profile=full/subsystem=transactions:write-attribute(name=default-timeout,value=500)
{
"outcome" => "success",
"result" => undefined,
"server-groups" => {"main-server-group" => {"host" => {"master" => {
"server-one" => {"response" => {
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}},
"server-two" => {"response" => {
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}}
}}}}
}
You can also do this configurations in the Management Interface .
You can also specify the time by method or class with an annotation. But the annotation can be different among the application servers, there is no specification about this in J2EE. For example, in Wildfly the annotation is @TransactionTimeout
:
@TransactionTimeout(1500)
And the time unit used in all cases is always in seconds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With