• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

javax.naming.NameNotFoundException: Name comp is not bound in this Context

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to access mysql using Tomcat 6 and connection pool.I have placed the required jars (mysql-connector-java-5.1.10-bin.jar,commons-collections-3.2.jar,tomcat-dbcp.jar)in catalina-home/lib .I've placed TomConn.xml file in catalina-home\conf\Catalina\localhost.
TomConn.xml


web.xml


I'm trying to access the dbase from index.jsp


When i run the code i get the following exception
INFO: Undeploying context [/TomConn]
May 25, 2010 9:46:50 PM org.apache.catalina.core.NamingContextListener lifecycleEvent
SEVERE: Creation of the naming context failed: javax.naming.NamingException: Context is read only
May 25, 2010 9:47:55 PM org.apache.catalina.core.NamingContextListener lifecycleEvent
SEVERE: Creation of the naming context failed: javax.naming.NamingException: Context is read only
Exception Ocurred
javax.naming.NameNotFoundException: Name comp is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
.....

There are lot of discussions on the internet...but still none could solve my problem .
Kindly advice.
Regards,
Poonam.
 
Bartender
Posts: 20842
125
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-1 for not placing braces on the "if" statement's predicate. I can't count the number of times I've slipped a line of code in on a 1-line "if" and had the whole thing blow on me. Braces are cheap insurance.

I'd be happier if I knew for certain which line in the sample code line the exception actually occurred on. And incidentally, if you must do database access on a JSP, I think you can find a tag that will do the necessary connection stuff for you - including JNDI lookup.

However, the top line of your message says Undeploying context. What's going on there? It appears to be shutting down the application.
 
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Poonam Kadu wrote:I'm trying to access mysql using Tomcat 6 and connection pool.I have placed the required jars (mysql-connector-java-5.1.10-bin.jar,commons-collections-3.2.jar,tomcat-dbcp.jar)in catalina-home/lib .I've placed TomConn.xml file in catalina-home\conf\Catalina\localhost



What do mean by catalina-home? Is it $CATALINA_HOME ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!