This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Jboss 5 - @Resource dataSource versus direct lookup in Session Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Jboss 5 - @Resource dataSource versus direct lookup in Session Bean" Watch "Jboss 5 - @Resource dataSource versus direct lookup in Session Bean" New topic
Author

Jboss 5 - @Resource dataSource versus direct lookup in Session Bean

Varun Chopra
Ranch Hand

Joined: Jul 10, 2008
Posts: 211
I have a stateless session bean (in ejb 3). If I use Dependency Injection of datasource it works perfectly.
But if I do direct lookup of datasource it does not work - it complains "jdbc not bound".
Can you help me here? How can it be that DI is able to find bound datasource while direct lookup is not able to do that?
Session bean along with its interface is in .jar file (and further it is in .ear file with .war file), while datsource XML file is deployed directly under default/deploy.

-Varun -
(My Blog) - Online Certifications - Webner Solutions
Varun Chopra
Ranch Hand

Joined: Jul 10, 2008
Posts: 211
It's working now after I changed datasource lookup name to java:myDS from java:comp/env/jdbc/myDS
But this was working fine under JBoss 4.2.2 with java:comp/env/jdbc/myDS and with EJB 2.1.
Is there a change in how JNDI names are referenced in JBoss 5 with ejb 3?
 
GeeCON Prague 2014
 
subject: Jboss 5 - @Resource dataSource versus direct lookup in Session Bean