• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

context lookup issues

 
nikil shar
Ranch Hand
Posts: 116
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 489
Eclipse IDE Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
nikil shar
Ranch Hand
Posts: 116
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 489
Eclipse IDE Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 489
Eclipse IDE Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 116
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
ya tried that as well, still no luck.

thanks for the reply.
 
Leonardo Carreira
Ranch Hand
Posts: 489
Eclipse IDE Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic