[jboss-user] [EJB 3.0] - Inject TransactionSynchronizationRegistry to stateless EJB

jaikiran pai do-not-reply at jboss.com
Wed May 26 10:08:34 EDT 2010


jaikiran pai [http://community.jboss.org/people/jaikiran] replied to the discussion

"Inject TransactionSynchronizationRegistry to stateless EJB"

To view the discussion, visit: http://community.jboss.org/message/544871#544871

--------------------------------------------------------------
> Carlo de Wolf wrote:
> 
> The TransactionSynchronizationRegistry should actually be available.
> See  https://jira.jboss.org/browse/JBAS-4445 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.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/544871#544871]

Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100526/40453bce/attachment-0001.html 


More information about the jboss-user mailing list