p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Apache Tomcat (http://p2p.wrox.com/forumdisplay.php?f=107)
-   -   Naming Exception in Tomcat5.x (http://p2p.wrox.com/showthread.php?t=32304)

enjay August 9th, 2005 06:45 AM

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.

angrycat August 9th, 2005 05:07 PM

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


angrycat August 9th, 2005 05:16 PM

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.


enjay August 12th, 2005 05:55 AM

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


All times are GMT -4. The time now is 03:09 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.