aspose file tools*
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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Configuring connetion pooling with tomcat 5.5" Watch "Configuring connetion pooling with tomcat 5.5" New topic
Author

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


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
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

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configuring connetion pooling with tomcat 5.5