Carlo de Wolf wrote:
The TransactionSynchronizationRegistry should actually be available.
See https://jira.jboss.org/browse/JBAS-4445 and JavaEE 6 Final Release - EE.5.11 TransactionSynchronizationRegistry References.
I don't see a test for it though, so that needs to be implemented.
Just checked this again and indeed we do bind the TransactionSynchronizationRegistry to JNDI. The EJBContainer binds it to the ENC and is just a LinkRef to java:TransactionSynchronizationRegistry. After checking the code, I went and looked at the JNDI tree again and it available in JNDI both under java: namespace and even the individual ENC of the beans. I think I missed it the last time I checked the JNDI tree.
Sergey Kiselev wrote:
I am trying inject TransactionSynchronizationRegistry to stateless EJB:
@Resource
protected TransactionSynchronizationRegistry transactionSynchronizationRegistry;
but unfortunately there is throws an error:
Caused by: java.lang.RuntimeException: mapped-name is required for
test.BaseService/transactionSynchronizationRegistry of deployment BaseService
Also in JNDI not contain TransactionSynchronizationRegistry with name - "java:comp/TransactionSynchronizationRegistry".
Sergey, changing that @Resource injection to:
@Resource (mappedName = "java:TransactionSynchronizationRegistry")
protected TransactionSynchronizationRegistry transactionSynchronizationRegistry;
should get you past that error.