This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes need help on porting a web application using jta to tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "need help on porting a web application using jta to tomcat" Watch "need help on porting a web application using jta to tomcat" New topic

need help on porting a web application using jta to tomcat

stefano bitossi

Joined: Oct 06, 2010
Posts: 5

my current situation is the following : i need to port an application developed for websphere 5 to tomcat 6. The original developer (who has leaved my firm) had used jta for handling transactions. I'm not so experienced with java and particularly with enterprise libraries (and neither my ex colleague i believe seeing the code) , so i need a couple of clearifications and some help on chosing the better approach to make this porting . The application is based on an Oracle database, in my (poor) knowledge of the matter , jta can be used both for distributed (through oracle xaconnection ) and common (via java.sql.connection ) transaction . I'm rather sure this application uses only java.sql.connection, but the code is a mess with multiple classes to access db, code spreaded on jsp pages and more. So my first approach has been : don't touch the code and add jta support to tomcat. I've made two attempts the first with atomikos the second (and actual ) with bitronix but i'm not able to make work any of the two.
My questions are:
1. where can i find a short tutorial which explains fundamentals of the jta and its use with not distributed transactions (and UserTransaction)
2. the BTM says :

You have to put your datasources configurations in Tomcat's conf/ file. Here's an example of using BTM with a DataSource that implements javax.sql.XADataSource:


This will create a that implements javax.sql.DataSource and interacts with the javax.sql.XADataSource provided in this instance by Derby.

If your database vendor does not provide an XADataSource, you can use BTM's as the XADataSource to allow your database connections to be controlled by the transaction manager:

as stated above i don't need distributed transaction , how should configure the above for Oracle 10 and what jdbc drivers should i use (ojdbc14.jar ? )

3. For Bitronix i've followed the tutorial at , and i'm been able to integrate it in Tomcat, but when the server starts (and when i try to resolve the datasource to javax.sql.DataSource in the login page ) the btm rise the following exception :

11-mar-2011 10.22.03 org.apache.naming.NamingContext lookup
AVVERTENZA: Unexpected exception resolving reference
java.lang.ClassCastException: java.lang.String cannot be cast to
at org.apache.naming.factory.ResourceFactory.getObjectInstance(
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at org.apache.naming.NamingContext.lookup(
11-mar-2011 10.22.03 org.apache.catalina.core.NamingContextListener addResource
AVVERTENZA: Failed to register in JMX: javax.naming.NamingException: java.lang.String cannot be cast to

can anyone give me hint about this exception please?

4. Which one is better for my situation bitronix or atomikos ? i need to keep external libraries inside the war (system administrators prefers do to keep the server clean) and configuration files outside the war

tahnk you in advance for any Help

Some news : i've changed the resource.propeties to

resource.ds.testQuery=SELECT 1 FROM DUAL

and i got a new error at server startup :

11-mar-2011 11.57.14 org.apache.catalina.core.NamingContextListener addResource
AVVERTENZA: Failed to register in JMX: javax.naming.NamingException: no resource registered with uniqueName 'jdbc/NraDbA', available resources: []

i'm using eclipse as develpment tool

It is sorta covered in the JavaRanch Style Guide.
subject: need help on porting a web application using jta to tomcat
Similar Threads
JDBC level transaction vs. JTA/JTS
JTA implementation for Tomcat 6.0
JTA for Tomcat
WARN : util.JDBCExceptionReporter - SQL Error: 942, SQLState: 42000
DATABASE ERROR: java.sql.SQLException: Invalid argument(s) in call