wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes context lookup issues 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 "context lookup issues" Watch "context lookup issues" New topic
Author

context lookup issues

nikil shar
Ranch Hand

Joined: May 25, 2008
Posts: 116
hi all,
i have a java interface and its implementation which talks to an oracle db. in the implementation i lookup the db using jndi name for the connection pool which is specified in the app server (glassfish v3). when i include this java app as a jar file in my classpath and call methods on it to talk to the db it works fine for me.
But when my team mate is trying to use this java same app as a jar file in his classpath and tries to talk to the db he gets errors while looking up the jndi name of the connection pool.
we have tried changing the name of the connection pool etc but no luck. any suggestions would be much apprecitated.


here how the java app looks up the db



we both use java 1.5, oracle 11g db.

thanks in advance.



forgot to mention we both deployed our code against the same app server which talks to the same db.
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi Nikil Shar..

Why don't you use EJB?..
As far as i know, Glassfish V3 has supported to EJB3.1 (the newer version of EJB, and its lighter than EJB3.0)..
if you work in EJB, you could inject the DataSource as follow :


Hope that helps..

please correct me if i'm wrong..

Thanks..

Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9937
    
159

Leonardo Carreira wrote:EJB3.1 (the newer version of EJB, and its lighter than EJB3.0)..



There are certainly new things in EJB3.1, but I wouldn't call EJB3.1 lighter than 3.0 Are you talking about the no-interface view of EJB3.1?


[My Blog] [JavaRanch Journal]
nikil shar
Ranch Hand

Joined: May 25, 2008
Posts: 116
unfortunately i dont have the option of using EJB. the overall design is done by someone else so am stuck with it.
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Jaikiran Pai wrote:
There are certainly new things in EJB3.1, but I wouldn't call EJB3.1 lighter than 3.0 Are you talking about the no-interface view of EJB3.1?


Hi Jaikiran Pai ..
i meant it because as far as i know, we could put EJB3.1 directly in WebApplication..
so, i think EJB3.1 lighter..
as far as i know, interface is become optional in EJB3.1.. //sorry, if i'm mistaken..

Thanks in advance..

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi nikil shar..

How do you configure jdbc JNDI in your web.xml?..
assume that you've configured jdbc jndi named "jdbc/mydb"..

try to access it use this code :


hope that helps..
Please correct me if i'm mistaken..

Thanks..
nikil shar
Ranch Hand

Joined: May 25, 2008
Posts: 116
hi,
ya tried that as well, still no luck.

thanks for the reply.
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

How do you configure jdbc JNDI in your web.xml?..
could you post the printStrackTrace() message in your server log file?..

Thanks..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: context lookup issues
 
Similar Threads
JDBC Exception in JNDI lookup
Problem in lookup datasource
db connection
How to use configured datasource
Config Sun ONE Application Server JDBC to link to MySQL Server