Hi all,
in the following message :
http://castor.exolab.org/list-archive/msg19375.html
Mickael contributed some code to make the WAS 4 Transaction Manager
available via JNDI.
In WAS 5, IBM have changed their JTSXA class: you must call 'instance()'
instead of 'getTransactionManager()' to get the singleton instance.
Here is a new version of Mickael's getTransactionManager() method working
with both versions of WAS:
private TransactionManager getTransactionManager() {
TransactionManager tm = null;
Class jtsxaClass = null;
try {
jtsxaClass = this.getClass().forName("com.ibm.ejs.jts.jta.JTSXA");
} catch (ClassNotFoundException e) {
logger.error("Could not get WAS transaction manager");
}
if (jtsxaClass != null) {
Method getTMMethod = null;
try {
// Under WAS4, the instance retrieving method of the JTSXA singleton
class
// is called "getTransactionManager()"
getTMMethod = jtsxaClass.getMethod("getTransactionManager", null);
} catch (NoSuchMethodException e) {
// Under WAS5, the instance retrieving method of the JTSXA singleton
class
// is called "getTransactionManager()"
try {
getTMMethod = jtsxaClass.getMethod("instance", null);
} catch (NoSuchMethodException e1) {
logger.error("Could not get an instance of the transaction manager.");
}
}
if (getTMMethod != null) {
try {
tm = (TransactionManager) getTMMethod.invoke(null, null);
} catch (Exception e) {
logger.error("Could not get an instance of the transaction manager.");
}
}
}
return tm;
}
Enjoy !
C�drick
_________________________________________________________________
MSN Messenger : discutez en direct avec vos amis !
http://www.msn.fr/msger/default.asp
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
