This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Configuring connetion pooling with tomcat 5.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Configuring connetion pooling with tomcat 5.5" Watch "Configuring connetion pooling with tomcat 5.5" New topic

Configuring connetion pooling with tomcat 5.5

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
I am using Tomcat 5.5 with admin package.

here is what i did :

Installed tomcat
Unzip the admin package
Copied the entire directory (admin package)/server/webapps/admin to <catalina_home>/server/webapps
Copied the file (admin package)/conf/Catalina/localhost/admin.xml to <catalina_home>/conf/Catalina/localhost

After that i configured JNDI in tomcat administration. I am using ORACLE database

Here is the values i provided

JNDI Name: jdbc/Test
Data Source URL: jdbc: oracle:thin: @localhost:1521: orcl
JDBC Driver Class: oracle.jdbc.driver.OracleDriver
User Name: abc
Password: abc
Max. Active Connections: 4
Max. Idle Connections: 2
Max. Wait for Connection: 5000

After saving the setup, its automatically updated in server.xml in C:\Tomcat 5.5\conf


url="jdbc: oracle:thin: @localhost:1521: orcl"/>

Here is my DAO class

Now when i run the application in Tomcat , it shows the following error in the console:

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
at org.apache.naming.NamingContext.lookup(
at org.apache.naming.NamingContext.lookup(
at org.ap.Util.DbUtil.<clinit>(
at org.ap.Dao.LoginDao.<init>(
at org.ap.Servlet.LoginServlet.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
at org.apache.tomcat.util.threads.ThreadPool$
at Source)

Am i missing something?

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
The problem has been solved. Actually, i didn't pasted the resource details in context.xml

I agree. Here's the link:
subject: Configuring connetion pooling with tomcat 5.5
Similar Threads
adding a Datasource to tomcat jndi
Tomcat can't find a JDBC JNDI resource
Problem with Tomcat/Data Source
How to: DataSource in tomcat 5 with netBeans 5
DataSource creation