views:

45

answers:

1

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?

+1  A: 

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
Thanks for the answer. Do you have any idea if this could be done without the `jta.properties` file?
HDave
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