• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat Connection Pooling Help required

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
/*******************///
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is your mysql driver jar file in the common/lib directory?
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic