| Author |
Tomcat Connection Pooling Help required
|
nitin kumar
Greenhorn
Joined: Feb 11, 2004
Posts: 6
|
|
Hi all, This may be repeated question, but I could not find any satisfying solution to my problem in previous solutions. i m working on developing a web application and want to implement database pooling. Server:: Tomcat 5.0 DB:: mysql 4.0 I deploy and undeploy my application using tomcat manager, hence i donot have the <Context> element configured in the server.xml For database pooling, I used the element <GlobalNamingResources> After these settings, the Tomcat Admin shows the Data Source Created with name jdbc/MyappDB When I run the application and hit the url where the database connection is obtained, I get the following error:: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver Can somebody help me on this ? Basically the question here is that, if the <Context> element is not used, what web.xml setting have to be made to access this Data source in Global area. Note: the <Context> element have the element <ResourceLink> to access such global resources. Following is my settings. /********************************/ <GlobalNamingResources> <Environment name="simpleValue" type="java.lang.Integer" value="30"/> <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/> <ResourceParams name="UserDatabase"> <parameter> <name>factory</name> <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value> </parameter> <parameter> <name>pathname</name> <value>conf/tomcat-users.xml</value> </parameter> </ResourceParams> <Resource name="jdbc/MyappDB" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/MyappDB"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxActive</name> <value>100</value> </parameter> <parameter> <name>maxIdle</name> <value>30</value> </parameter> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <parameter> <name>username</name> <value>admin</value> </parameter> <parameter> <name>password</name> <value>admin123</value> </parameter> <parameter> <name>driverClassName</name> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:mysql://localhost/myapp?autoReconnect=true</value> /parameter> </ResourceParams> </GlobalNamingResources> /*******************************/// web.xml settings.. <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/MyappDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> /*******************///
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26168
|
|
Nitin, This sounds like a classpath or Tomcat configuration issue. I'm going to move this to our Tomcat forum so you can get more help.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Mike Curwen
Ranch Hand
Joined: Feb 20, 2001
Posts: 3695
|
|
|
is your mysql driver jar file in the common/lib directory?
|
 |
Nina Savannah
Ranch Hand
Joined: Oct 15, 2008
Posts: 35
|
|
Hi Nitin Kumar, did you manage to find a solution for this problem? I have the same specification and I am trying to do connection pooling, can you help?
|
 |
Bhaskar Rao
Greenhorn
Joined: Apr 25, 2005
Posts: 23
|
|
Hi, I have had this issue earlier. This is a generic error and can be thrown for various reasons. Have you tried defining the context as either 'context.xml' or yourwebappname.xml ? have a look at the following URLTomcat config [ December 28, 2008: Message edited by: Bhaskar Rao ]
|
 |
 |
|
|
subject: Tomcat Connection Pooling Help required
|
|
|