Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
| Search | Today's Posts | Mark Forums Read
Apache Tomcat General 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
 
Old August 9th, 2005, 06:45 AM
Authorized User
 
Join Date: Apr 2005
Location: , , India.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default Naming Exception in Tomcat5.x

Hi,

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");


The last line throws the error mentioned above.

Still it throws the NameNotFoundException.

Please advise.

eNJay.
 
Old August 9th, 2005, 05:07 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

initCtx.looup, dont you mean
initCtx.lookup :-)

 
Old August 9th, 2005, 05:16 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old August 12th, 2005, 05:55 AM
Authorized User
 
Join Date: Apr 2005
Location: , , India.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Thank you for the reply.

Sorry for the typo.

I found that useNaming was set to false in xml file of the context. Setting it to True has resolved the issue.

Regards,
eNJay




Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Configuring tomcat5.0 with IIS 5.1 skiiqbal Apache Tomcat 1 June 25th, 2006 07:51 AM
puzzled with tomcat5.5.9 Edward King Apache Tomcat 1 September 21st, 2005 02:00 AM
Why Tomcat5.5.9 can't work? Edward King Apache Tomcat 1 August 12th, 2005 06:03 AM
Tomcat3.3.2 to Tomcat5.0.24 amith_pj Apache Tomcat 2 July 10th, 2005 04:23 AM
Tomcat3.3.2 to Tomcat5.0.24 amith_pj Servlets 1 August 11th, 2004 01:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.