Java – how to set transaction timeout on jetty JNDI atomikos configuration
I am converting various spring beans into JNDI lookup I'm currently using jetty to test it I configured the UserTransaction according to the jetty document, which works:
<New id="tx" class="org.mortbay.jetty.plus.naming.Transaction"> <Arg> <New class="com.atomikos.icatch.jta.UserTransactionImp"> </New> </Arg> </New>
The problem with this configuration is that it does not set the transaction timeout as in my spring configuration:
<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <!-- Number of seconds before transaction timesout. --> <property name="transactionTimeout" value="30" /> </bean>
I tried the following, but it didn't work... For some reason, I finally got two user transactions:
<New id="tx" class="org.mortbay.jetty.plus.naming.Transaction"> <Arg> <New class="com.atomikos.icatch.jta.UserTransactionImp"> <Set name="transactionTimeout">30</Set> </New> </Arg> </New>
Any ideas?
Solution
You need to go through JTA. Net in the jetty context The properties file configures the atomikos transaction manager
> /jetty-6.1. 24/contexts/test-jndi. d/WEB-INF/classes
> jta. properties
Set the name to com atomikos. icatch. max_ Timeout attribute, which is commented out in the default sample file Then make sure to start the jetty container with the correctly configured context