4

I am in the process of converting various Spring beans to JNDI lookups. Currently I am using Jetty to test this. I have configured the UserTransaction according to the Jetty documentation and it 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 it that it does not set the transaction timeout like my Spring config did:

<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 ended up with 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?

Dave
  • 21,524
  • 28
  • 141
  • 221

1 Answers1

1

You'll need to configure the atomikos transaction manager through the jta.properties file within your jetty context.
For example, look at the following directory within your Jetty distribution (I'm using 6.1.24):

  • /jetty-6.1.24/contexts/test-jndi.d/WEB-INF/classes
    • jta.properties

set the property called com.atomikos.icatch.max_timeout, which is commented out in the default sample file.
Then make sure that you start your jetty container using the correctly configured context.

crowne
  • 8,456
  • 3
  • 35
  • 50
  • 1
    Thanks for the answer. Do you have any idea if this could be done without the `jta.properties` file? – Dave Oct 22 '10 at 12:52
  • I imagine it might be possible, but you'd have to set the values in the transaction manager as part of the server startup process. – crowne Oct 22 '10 at 18:33
  • Yes it is possible without the jta.properties. You can pass parameters to com.atomikos.icatch.config.UserTransactionServiceImp.UserTransactionServiceImp class. If you use spring you can do it there or you can do it programmatically. – arrehman Nov 14 '12 at 15:21