Using JBoss-3.0.3 I encountered problems within a simple stateless session
bean with bean manged XA UserTransactions. The first
UserTransaction().begin()/commit() pair ( source code at end of file ) is
successfull, but within the second UserTransaction().begin() call I get the
following exception.
[XATxConnectionManager$XAConnectionEventListener] in Enlisting tx, illegal
state: TransactionImpl:XidImpl [FormatId=257, GlobalId=note-639//15,
BranchQual=]
[STDERR] java.lang.IllegalStateException: Can't enlist - already a tx!
[STDERR] at
org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEvent
Listener.enlist(XATxConnectionManager.java:250)
[STDERR] at
org.jboss.resource.connectionmanager.XATxConnectionManager.transactionStarte
d(XATxConnectionManager.java:190)
[STDERR] at
org.jboss.resource.connectionmanager.CachedConnectionManager.userTransaction
Started(CachedConnectionManager.java:316)
[STDERR] at
org.jboss.ejb.EnterpriseContext$UserTransactionImpl.begin(EnterpriseContext.
java:465)
[STDERR] at
de.mobilcom.eai.adapter.mcbs.event.MCBSEventAdapterTDB.ejbTimeout(MCBSEventA
dapterTDB.java:364)
I realized that the transaction gets enlisted with a call to
XAConnectionEventListener.enlist() during the first begin() call. But the
corresponding delist() method doesn't get called within the first commit(),
so the second call to begin() causes the exception. Is this a bug in
JBoss-3.0.3 or am I doing something wrong ?
Any help would be appreciated !
Regards
Ulf
And here is the simple code snippet
public void ejbTimeout( Timer timer )
{
Connection connectionBase = null;
try
{
connectionBase = m_DataSourceBase.getConnection();
connectionBase.setAutoCommit( false );
// user transaction 1
try
{
m_Ctx.getUserTransaction().begin();
m_Ctx.getUserTransaction().commit();
}
catch( Exception e )
{
try { m_Ctx.getUserTransaction().rollback(); } catch(
Exception ignore ) {}
}
// user transaction 2
try
{
m_Ctx.getUserTransaction().begin();
!!!!!!! throws exception !!!!!
m_Ctx.getUserTransaction().commit();
}
catch( Exception e )
{
try { m_Ctx.getUserTransaction().rollback(); } catch(
Exception ignore ) {}
}
}
catch( Exception e )
{
}
finally
{
// Always close pooled resources !
if( connectionBase != null ) try { connectionBase
.close(); } catch( Exception e ) {}
}
-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future
of Java(TM) technology. Join the Java Community
Process(SM) (JCP(SM)) program now.
http://ad.doubleclick.net/clk;4699841;7576301;v?http://www.sun.com/javavote
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user