wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Tomcat 4.1.31 Connection Pooling Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 4.1.31 Connection Pooling Problem " Watch "Tomcat 4.1.31 Connection Pooling Problem " New topic
Author

Tomcat 4.1.31 Connection Pooling Problem

vikrams sawant
Greenhorn

Joined: Nov 02, 2004
Posts: 4
Hi ,
I am having a problem in creating the Connection Pool for Tomcat. I have created the Data Source through the Admin interface in the Tomcat Server. I am
getting the DataSource Object. But when getting the Connection Object by using getConnection() Method I am getting the following exception .


org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '
org.postgresql.Driver' for connect URL 'jdbc ostgresql//192.168.0.53/xtend', ca
use:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:743)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:518)

i am using postgresql7.3.2 . I have placed the JDBC Driver jar file in the
server\common\lib directory . From the error message it seems that Tomcat is not able to load the corresponding jar file of the JDBC Driver. Can any one help me in solving the problem

Content of the server.xml file regarding the Context is as follows

<Context className="org.apache.catalina.core.StandardContext" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false" debug="0" docBase="F:\jakarta-tomcat-4.1.31\webapps\alienrevolt" mapperClass="org.apache.catalina.core.StandardContextMapper" path="/alienrevolt" privileged="false" reloadable="false" swallowOutput="false" useNaming="true" workDir="work\Standalone\localhost\alienrevolt" wrapperClass="org.apache.catalina.core.StandardWrapper">
<Resource name="jdbc/alienrevolt" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/alienrevolt">
<parameter>
<name>url</name>
<value>jdbc ostgresql//192.168.0.53/xtend</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.postgresql.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>postgres</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
</Context>
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
The jar containing the driver should be in the /WEB-INF/lib of your application, or common/lib of tomcat.

If that doesn't work, it may be that jar's internal structure is incorrect.
Rename it to zip, open and make sure things are where they should be. Finally, double check the fully qualified class name.
vikrams sawant
Greenhorn

Joined: Nov 02, 2004
Posts: 4
As per your suggestion i have made the necessary changes of renaming the file but still there is some error when i am calling the servlet

org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.postgresql.Driver', cause:
java.lang.ClassNotFoundException: org.postgresql.Driver
at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClas
sLoader.java:945)
at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClas
sLoader.java:810)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:730)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:518)

well the good thing i am noticing is that error message is diff from the previous one.

Thanks Very mech
for the Reply ,
 
 
subject: Tomcat 4.1.31 Connection Pooling Problem