JTA support for Servlet container ?
dlmiles Apr 18, 2013 8:43 AMHello this question must have been asked by many people before, but there does not seem to be a useful reply I can find.
I am looking to add JTA support to Tomcat7 ideally using JBoss TS (since my intended upgrade path is to move towards JBoss AS).
* Webapp uses Spring Framework 3.2.x with Hibernate 4
* Webapp currently uses Tomcat7 built in JDBC connection pooling (I think maybe I can continue to use this as-is?)
* Webapp works great with a single JDBC connection in use at a time.
* Need to add support for multiple JDBC connections to be in use at the same time by the same thread in a single transaction.
* No advanced JBossTS features are needed (at least I don't think I need them), no recovery, no CORBA/ORB/WS support, no multi/cross JVM transaction support. No nothing that is outside of the scope set here.. All this stuff can be shutdown/disabled.
* No need to support extended transactions, all transactions occur synchronously within the thread that started and owns them to completion.
* Must support multiple JDBC transactions (for drivers MSSQL/MySQL/PostgreSQL)
* Would like to support remote EJB, remote JMS transactions
* Would like to support XA (if that is an optional aspect, otherwise this is a 'Must' support XA)
* Would like to have a unit test suite to verify XA ACID claims of the setup and final configuration and/or highlight potential areas of concern.
* As it is running on Tomcat7 the JNDI support is limited, some limitations on JNDI use may exist, such as only being able to write to JNDI object during container startup from server.xml config (not from inside a WAR deployment)
* Need to be debuggable, I turned logging upto TRACE level in my attempt so far and got no useful information out of JBoss TS to resolve not being able to establish a Transaction object.
To me the various specifications are very mature, so this should be straightforward right, there is enough open-source around reuse by now right ?
I am trying to understand the details, such as where XA JDBC sources fit in and the problems in solving that issue within Tomcat.
From my point of view it looks like I can continue to use the Tomcat built in JDBC connection pooler but I simply change the Driver/DataSource class implementation to the vender provided XA version ? I presume that interface.
I am expecting some wrapper between JTA implementation and the connection pooler that irons out all the quirks that may exist to provide XA support.
It maybe necessary for this connection wrapper to support faking 2-phase commit when the underlying Connection/SQL database does not support it (turned off, or feature not available), this should be something I authorize and set via configuration, it should not do this by default.
Some part of the system might needs to be in the Tomcat container's server classpath (not inside the WAR) that would be ok too. Maybe by doing this it would be possible get standard JNDI lookups for JTA to exist.
At this time I can not use JBossAS 7 or EAP 6 due to issues I need to work through (AS bugs not my app bugs) and the fact I am already using Tomcat 7.0.3x WebSockets that no JBoss AS supports yet. I can restructure my application to put the web-app part on Tomcat and use remote EJB to a JBoss AS instance and this is probably what I shall do in the future until JBoss AS support WebSockets.