In Glassfish, the EJB transaction timeout is set to 120 seconds by default, and I want to change this value.
I know that it can be changed by specifying the cmt-timeout-in-seconds parameter in the glassfish-ejb-jar.xml file, but I use the web module with its EJB classes and use Glassfish-web.xml accordingly.
Is there a way to change the timeout?
UPD:
The transaction timeout value in the transaction service settings is not affected.
@Schedule(minute = "*/5", hour = "*", persistent = false)
public void doSomething() {
log.info("Started");
try {
Thread.sleep(1000 * 119);
} catch (InterruptedException ex) {
log.info("Interrupted", ex);
}
log.info("Finished");
}
This code works just fine. But if you change the sleep time to 121 seconds
Thread.sleep(1000 * 121);
in the GF server log I see an error:
Warning: EJB5123:Rolling back timed out transaction
After that, the service calls the doSomething () method again, and after 2 minutes I see errors again:
Warning: EJB5123: Rolling back timed out transaction
Info: EJB5119:Expunging timer [...] after [2] failed deliveries
and the service no longer calls the doSomething () method.