• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

context lookup issues

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
ya tried that as well, still no luck.

thanks for the reply.
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic