| Author |
@Resource injection not working for DataSource
|
pulkit mehra
Greenhorn
Joined: Jun 05, 2008
Posts: 12
|
|
Hi Ranchers,
I am facing some problem in getting datasource from JNDI using @Resource annotation.
My server is JBoss5.1 and EJB 3.0.
My DS file
My Persistence.xml
StatelessBean
Web Client(local in Server EAR)
Problem Faced:
1)Not able to get statelessbean instance as resource injection getting failed.I have checked JMX console's JNDI view.
I am able to locate titanDatasource in Global section as well as in stateless bean ENC(linking global JNDI titanDatasource)
ServerError is :
2)I am confused between @Resource attribute name and mappedName My understanding is MappedName reference Global JNDI attributes where as name reference ENC attributes;
Please helpe me!!
|
 |
pulkit mehra
Greenhorn
Joined: Jun 05, 2008
Posts: 12
|
|
Hi Friends ,
My server unexpectedly start working in above said scenario .Cant rely on open source servers but here what i have learned :
1)DS can be binded to java namespace or into Global JNDI section using <use-java-context> in DS file.
2)Always use DI names as per binding:
If used <use-java-context> true then mappedName = 'java:/titanDatasource'
If used <use-java-context> false then mappedName = 'titanDatasource'
|
 |
 |
|
|
subject: @Resource injection not working for DataSource
|
|
|