Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JNDI , Tomcat  RSS feed

 
Stephen Callaghan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to get a JNDI value in a servlet init() method using 4.1.24 version of tomcat. However i'm having no luck and getting nothing back, can anyone see what i'm doing wrong? Thanks.
server.xml
<!-- Global JNDI resources -->
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
</GlobalNamingResources>
within servlet init method:
Context ctx = new InitialContext();
Object value = ctx.lookup("java:/comp/env/simpleValue");
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put your JNDI value in web.xml.
[ November 07, 2003: Message edited by: Pradeep Bhat ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!