Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.0
-
Fix Version/s: 2.0.1
-
Labels:None
-
Number of attachments :
Description
Hi,
I tried to use TransactionSynchronizationRegistry interface (part of JTA 1.1 spec) but got following exception instead:
java.lang.NullPointerException
at bitronix.tm.BitronixTransactionSynchronizationRegistry.getResource(BitronixTransactionSynchronizationRegistry.java:45)
at (...... - not important)
I checked the code and it looks like the ThreadLocal value is not properly initialized for new threads.
Instead of:
private final static ThreadLocal resourcesTl = new ThreadLocal();
public BitronixTransactionSynchronizationRegistry()
{ transactionManager = TransactionManagerServices.getTransactionManager(); resourcesTl.set(new HashMap()); }the code should read:
private final static ThreadLocal resourcesTl = new ThreadLocal() {
protected Object initialValue()
};
public BitronixTransactionSynchronizationRegistry()
{ transactionManager = TransactionManagerServices.getTransactionManager(); }
Fixed in trunk; new 2.0.1-SNAPSHOT build has been uploaded so you can easily try it out. See http://docs.codehaus.org/display/BTM/Maven2
Please report back if this new version works for you.