Hi,
I am currently trying to track down the problem
of a NPE thrown from TransactionImpl.getStatus()
called from the BMTInterceptor on return from a
invokcation on a stateless BMT bean.
This only happens if the BMT bean was called from
another bean in a transaction context.
The problem was that the TransactionImpl that came
with the invocation of the BMT bean was never
imported into the transaction manager (all instances
of TransactionImpl should be imported after
travelling over RMI, and for CMT this is done
implicitly in TxMamager.associateThread()), but this
transaction was being used to check that it was
terminated on return from the stateless BMT bean.
But of course we should not have to import the
client transaction coming in the MI, as that should
never be used in a BMT bean.
After a lot of head scratching while wondering how
come a transaction that should not be used is
suddenly the current transaction of the enterprise
context on return from BMT.invoke() but not on entry,
I finally found the offending code:
In StatelessSessionContainer.ContainerInterceptor.invoke()
I found this piece of code:
// wire the transaction on the context, this is
// how the instance remember the tx
if (mi.getEnterpriseContext().getTransaction() == null)
mi.getEnterpriseContext().setTransaction(mi.getTransaction());
Problem is that mi.getTransaction() returns the
transaction (that was never imported and should not
be used) of the caller.
I wonder why this code is placed here.
Doesn't it belong in the transaction interceptors?
Please advice.
Best Regards,
Ole Husgaard.