View Single Post
  #1 (permalink)  
Old August 9th, 2005, 06:45 AM
enjay enjay is offline
Authorized User
Join Date: Apr 2005
Location: , , India.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default Naming Exception in Tomcat5.x


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.

Reply With Quote