Apache TomcatGeneral discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I am trying to lookup Database object using JNDI and have the following error.
javax.naming.NameNotFoundException: Name java:comp is not bound in
this Context
I have configured DataSource in the context and I can see that listed in xml file of my application context( the file in /conf/localhost directory). I have added resource reference in web.xml of my application.
I have used the following code im my servlet
Context initCtx = new IntialContext();
Context envCtx = (Context)initCtx.looup("java:comp/env");
If this was a typo in your post, then have a look at the tomcat documentation, it has the best tutorial on jndi ive found, quite short, wont take long to check what youve done.