15 November 2013

How to control *all* JTA properties in JBoss AS 7 / EAP 6

JBoss AS 7 and therefore EAP 6 comes with a great simplification of its configuration. Depending on your setup you can use either standalone.xml or domain.xml to configure everything! One file to rule them all! Well, almost all.

If you need fine-grained tuning you might end-up in a situation where the configuration option is not exposed via JBoss' subsystem configuration and you have to use a different approach. For some reason I had to set the xaTransactionTimeoutEnabled property of JTA configuration bean to false. This property is true by default and it means when a resource is enlisted within a transaction the JBoss Transaction Manager calls XAResource::setTransactionTimeout() passing the global JTA timeout value to it. Some (broken) resource managers really doesn't like it and it may result in a heuristic ending of the transaction. Unfortunately I couldn't find a way how to control this property via the transactions subsystem, so I had to find an alternative or hack if you like.



It's surprisingly easy: 

1. Create a jta.xml file with following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
  <entry key="com.arjuna.ats.jta.xaTransactionTimeoutEnabled">false</entry>
</properties>
The file must be readable for a JBoss server

2. Create a property with key "com.arjuna.ats.arjuna.common.propertiesFile", value will be the path to the jta.xml file created in the previous step. I've created my property on a server group level, but I assume it would work on any level.

3. Restart the server

4. Profit!


Be aware that most of the properties will be overwritten by the JBoss Transactions subsystem. You should really treat this as a last resort when the subsystem does not provide a better configuration mechanism. You can look here to get an idea how the configuration via subsystem is working.


1 comment :

  1. Hello Jaromir, thanks for your time and information, but what do you mean by "I've created my property on a server group level"? In which file did you created this property? I would like to try out your ideas in an application of mine.
    Thanks!

    ReplyDelete