OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | jotm List | October 2006 Index

<--  Date Index  --> <--  Thread Index  -->

using JOTM with simple-jndi


In the course of upgrading Tomcat versions from 4.x to 5.5, I have had to 
swap out Tyrex for JOTM, as Tyrex is no longer viable with the latest 
revision. The Tomcat switch itself has gone incredibly smoothly, and JOTM was 
quite quick to implement.

However, we were also using Tryex in standalone Java batch processes (totally 
separate from any web servers). Tyrex has an object called "TyrexDomain" that 
loads all the environmental datasource information from an xml file, which 
was also used by Tomcat to load the resource connect strings. That domain 
object allows transactions to be created from the same file of connect info, 
both within the web server and from this standalone application.

What I would like to do to replace this functionality is implement JOTM and 
simple-jndi together. The reason behind using simple-jndi is fairly 
straight-forward: we already have another (non-transactional) standalone 
application that loads connections from those property files. ***The main 
thing I need to avoid is creating yet another properties file that contains 
the same connection information present in both the context.xml file in 
Tomcat and the simple-jndi configuration files.*** (Because we have separate 
connection information for 5+ different database environments, it's important 
to us to keep these files to a minimum.)

I was hoping someone else on this list may have similar experience in using 
these two tools outside of a web server.

Right now, I have a util class in which datasources come from simple-jndi and 
UT from JOTM; but, the UT is not bound to those connections. 

<code>
 ictx = new InitialContext();
 ictx.bind(USER_TRANSACTION_JNDI_NAME, jotm.getUserTransaction());
...
 this.ut = ( UserTransaction )ictx.lookup( USER_TRANSACTION_JNDI_NAME );
</code>

And, to retrieve the connections, very straightforward:
<code>
DataSource dataSource = ( DataSource )ictx.lookup( jndiPath + resource );
conn = dataSource.getConnection();
</code>

Obviously, the connections themselves work, but ut.commit or ut.rollback are 
useless.

I think all I really need is a way to specify the factory/type in 
simple-jndi, so I can cast DataSource to XADataSource and bind the jotm 
object via setTransactionManager.

Does anyone know how to do this? I realize this may be more of question for 
the simple-jndi list (and I will post the same there), but I was just hoping 
that someone has some experience with doing something similar with JOTM OR 
would tell me if I'm just way off base here.

Thank you so much for you help,
Teresa



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.