• 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

Configuring connetion pooling with tomcat 5.5

 
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


server.xml

<Resource
name="jdbc/Test"
type="javax.sql.DataSource"
maxActive="4"
maxIdle="2"
username="hibernate"
maxWait="5000"
driverClassName="oracle.jdbc.driver.OracleDriver"
password="hibernate"
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(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.ap.Util.DbUtil.<clinit>(DbUtil.java:20)
at org.ap.Dao.LoginDao.<init>(LoginDao.java:16)
at org.ap.Servlet.LoginServlet.doPost(LoginServlet.java:44)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:689)
at java.lang.Thread.run(Unknown Source)



Am i missing something?


 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem has been solved. Actually, i didn't pasted the resource details in context.xml

Thanks.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!