• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

tomcat JNDI bug????

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone...

i use JNDI to read some configuration variables... but problem is
that sometimes it works but sometimes it does not (without reconfiguring
tomcat in between). I use 5.5.7 on java 1.5.0_02 (and I tried this on
Windows and Linux).

Here is definition in application's web.xml file:

<env-entry>
<env-entry-name>uri</env-entry-name>
<env-entry-value>jdbc:mysql://localhost:3306/webadmin</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>

I try to read it with:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
uri = (String)envCtx.lookup("uri");

sometimes it is ok... but sometimes I got next message:

Name java:comp is not bound in this Context

I do not know if this is some misconfiguration or what?
any ideas?

thnx
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic