-
1. Re: Inject TransactionSynchronizationRegistry to stateless EJB
jaikiran May 11, 2010 8:38 AM (in response to intr13)From what I know, the TransactionSynchronizationRegistry isn't made available in JNDI, in JBoss AS.
-
2. Re: Inject TransactionSynchronizationRegistry to stateless EJB
intr13 May 25, 2010 11:19 AM (in response to jaikiran)How to get the TransactionSynchronizationRegistry?
p/s
I am using the maven.
-
3. Re: Inject TransactionSynchronizationRegistry to stateless EJB
jaikiran May 26, 2010 5:39 AM (in response to intr13)Sergey Kiselev wrote:
How to get the TransactionSynchronizationRegistry?
p/s
I am using the maven.
I'm not sure I understand the question. Are you asking how to get hold of TransactionSynchronizationRegistry during runtime? If so, then I guess I already answered it. You can't get that from JBoss AS.
Or are you asking how to include it in your classpath during build time?
-
4. Re: Inject TransactionSynchronizationRegistry to stateless EJB
wolfc May 26, 2010 9:31 AM (in response to jaikiran)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.
-
5. Re: Inject TransactionSynchronizationRegistry to stateless EJB
jaikiran May 26, 2010 10:07 AM (in response to wolfc)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.
-
6. Re: Inject TransactionSynchronizationRegistry to stateless EJB
intr13 May 26, 2010 10:29 AM (in response to intr13)Thank you all,The following code actually works:@Resource(mappedName = "java:comp/TransactionSynchronizationRegistry") TransactionSynchronizationRegistry transactionSynchronizationRegistry;
Oddly enough, before I had a problem with this, it may be connected with the use of embedded-jboss. I will check tomorrow. -
7. Re: Inject TransactionSynchronizationRegistry to stateless EJB
intr13 May 26, 2010 11:28 AM (in response to intr13)It is correct working in the JBoss AS. But I have problems with getting TransactionSynchronizationRegistry in the jboss-embedded. What can I do? Any ideas?
svn: https://intr13-examples.googlecode.com/svn/TransactionalCache
subproject: ejb3-test
test-src: src/test/java
main-class: ru/intr13/example/jboss/transactionalCache/EjbTestCase.java