Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat JNDI bug????

 
asirob civokviz
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic