Re: Same old story :( "Cannot load JDBC driver class 'null'"

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Matthias Vach <matthias(dot)vach(at)web(dot)de>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Same old story :( "Cannot load JDBC driver class 'null'"
Date: 2004-03-03 16:10:21
Message-ID: 1078330221.3260.496.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Matthias,

Have you read this ?
http://doc.postgresintl.com/jdbc/ch11s04.html

If it still doesn't work let me know.

Dave

On Wed, 2004-03-03 at 10:26, Matthias Vach wrote:
> Hi all,
> first of all, sorry for this long mail, but i´m working on this problem since 4 days. And i really
> need help.
> I read a lot of websites about this problem but i still can't fix my problem so i hope you could
> help me.
>
> Thank you very much.
>
> Every time i try to connect the postgresql-Database with my little JSP (running in Tomcat) i got
> this Error:
> --> java.sql.SQLException: Cannot load JDBC driver class 'null' <--
>
> my environment
> -----------------------------------------------
> PostgreDB and Tomcat are running on the same Server.
> - the DB is named "mze"
> - the user for this DB is named also "mze"
> - the user has no password for the DB so it's ""
>
> my Tomcat version 4.1.18
> my Tomcat is listening on Port 4444
>
> my Tomcat-Directory is: /opt/jakarta/tomcat
> the Environment varibabl is: CATALINA_HOME=/opt/jakarta/tomcat
>
> the Name of my Webapplication is:
> %CATALINA_HOME%/webapps/Timerecording
>
> my jsp is lying in:
> %CATALINA_HOME%/webapps/Timerecording/WEB-INF/jsp
>
> my javaclass is lying in:
> %CATALINA_HOME%/webapps/Timerecording/WEB-INF/src
>
> the JDBC-Driver "pg73jdbc3.jar is lying in:
> %CATALINA_HOME%/common/lib
> -----------------------------------------------
>
>
> web.xml of my webapp:
> -----------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
>
> <web-app>
> <servlet>....</servlet>
> <servlet-mapping>....</servlet-mapping>
>
> <resource-ref>
> <description>postgreSQL Connection</description>
> <res-ref-name>jdbc/mze</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> </web-app>
> -----------------------------------------------
>
>
> javaclass of my webapp
> -----------------------------------------------
> public class Order {
> String connectionState = "Not Connected";
>
> public void init() throws Exception {
> DataSource ds=null;
> Connection conn=null;
>
> Context ctx = new InitialContext();
> ds = (DataSource) ctx.lookup("java:comp/env/jdbc/mze");
>
> try{
> conn = ds.getConnection(); //<----------------EXCEPTION HERE
> }
> catch(Exception e){ throw new Exception("Boom - No Connection -->"+e); }
>
> try {
> if (conn != null) {
> ...
> conn.close();
> }
>
> }
> catch (Exception e) {throw new Exception(" conn == null -->" + e); }
> }
> -----------------------------------------------
>
>
> server.xml of my tomcat
> (sorry i don´t know what is important to fix my problem.So it´s very long! Sorry!
> the most important is at the tail of this file):
> -----------------------------------------------
> <Server port="8005" shutdown="SHUTDOWN" debug="0">
>
> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
> debug="0"/>
>
> <GlobalNamingResources>
> <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
> <Resource name="UserDatabase" auth="Container"
> type="org.apache.catalina.UserDatabase"
> description="User database that can be updated and saved"></Resource>
> <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>
> </GlobalNamingResources>
>
> <Service name="Tomcat-Standalone">
>
> <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
> port="4444" minProcessors="5" maxProcessors="75"
> enableLookups="true" redirectPort="8443"
> acceptCount="100" debug="0" connectionTimeout="20000"
> useURIValidationHack="false" disableUploadTimeout="true" />
>
> <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
> port="8009" minProcessors="5" maxProcessors="75"
> enableLookups="true" redirectPort="8443"
> acceptCount="10" debug="0" connectionTimeout="0"
> useURIValidationHack="false"
> protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
>
> <!-- Define the top level container in our container hierarchy -->
> <Engine name="Standalone" defaultHost="localhost" debug="0">
>
> <!-- Global logger unless overridden at lower levels -->
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="catalina_log." suffix=".txt"
> timestamp="true"/>
>
> <!-- Because this Realm is here, an instance will be shared globally -->
> <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> debug="0" resourceName="UserDatabase"/>
>
> <!-- Define the default virtual host -->
> <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
> autoDeploy="true">
>
> <Logger className="org.apache.catalina.logger.FileLogger"
> directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>
>
> <!-- Tomcat Examples Context -->
> <Context path="/examples" docBase="examples" debug="0" reloadable="true"
> crossContext="true">
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="localhost_examples_log." suffix=".txt" timestamp="true"/>
> <Ejb name="ejb/EmplRecord" type="Entity"
> home="com.wombat.empl.EmployeeRecordHome"
> remote="com.wombat.empl.EmployeeRecord"/>
>
> <Environment name="maxExemptions" type="java.lang.Integer" value="15"/>
> <Parameter name="context.param.name" value="context.param.value"
> override="false"/>
>
> <Resource name="jdbc/EmployeeAppDb" auth="SERVLET"
> type="javax.sql.DataSource"/>
> <ResourceParams name="jdbc/EmployeeAppDb">
> <parameter><name>username</name><value>sa</value></parameter>
> <parameter><name>password</name><value></value></parameter>
>
> <parameter><name>driverClassName</name><value>org.hsql.jdbcDriver</value></parameter>
>
> <parameter><name>url</name><value>jdbc:HypersonicSQL:database</value></parameter>
> </ResourceParams>
>
> <Resource name="mail/Session" auth="Container" type="javax.mail.Session"/>
> <ResourceParams name="mail/Session">
>
> <parameter><name>mail.smtp.host</name><value>localhost</value></parameter>
> </ResourceParams>
>
> <ResourceLink name="linkToGlobalResource"
> global="simpleValue"
> type="java.lang.Integer"/>
>
> </Context>
>
> <Context path="/webapps/Timerecording" docBase="Timerecording" debug="0"
> reloadable="true" crossContext="true">
>
> <!-- PostgreSQL anbindung -->
> <Resource name="jdbc/mze" auth="Container" type="javax.sql.DataSource"/>
> <ResourceParams name="jdbc/mze">
> <parameter>
> <name>factory</name>
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> </parameter>
> <parameter>
> <name>url</name>
> <value>jdbc:postgresql://127.0.0.1:5432/mze</value>
> </parameter>
> <parameter>
> <name>driverClassName</name>
> <value>org.postgresql.Driver</value>
> </parameter>
> <parameter>
> <name>username</name>
> <value>mze</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value>mze</value>
> </parameter>
> <parameter>
> <name>maxActive</name>
> <value>20</value>
> </parameter>
> <parameter>
> <name>maxIdle</name>
> <value>10</value>
> </parameter>
> <parameter>
> <name>maxWait</name>
> <value>3000</value>
> </parameter>
> </ResourceParams>
> </Context>
>
> </Host>
> </Engine>
> </Service>
> </Server>
> -----------------------------------------------
>
> Thank you for all help
> Matthias
>
>
>
>
>
>
>
>
>
> _______________________________________________________________________
> Ein Grund zum Feiern: Die PC Praxis ermittelt zwischen 10 grossen
> Mailprovidern WEB.DE FreeMail als Testsieger http://f.web.de/?mc=021190
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
--
Dave Cramer
519 939 0336
ICQ # 14675561

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message James Robinson 2004-03-03 16:32:35 Re: calling function
Previous Message Bhushan Bhangale 2004-03-03 15:36:19 Re: Same old story :( "Cannot load JDBC driver class 'null