Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Varun Chopra
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Chopra
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic