Same old story :( "Cannot load JDBC driver class 'null'"
Same old story :( "Cannot load JDBC driver class 'null'"
От:
"Matthias Vach" <matthias.vach@web.de>
Дата:
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:
-----------------------------------------------
....
....
postgreSQL Connection
jdbc/mze
javax.sql.DataSource
Container
-----------------------------------------------
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):
-----------------------------------------------
factory
org.apache.catalina.users.MemoryUserDatabaseFactory
pathname
conf/tomcat-users.xml
usernamesa
password
driverClassNameorg.hsql.jdbcDriver
urljdbc:HypersonicSQL:database
mail.smtp.hostlocalhost
factory
org.apache.commons.dbcp.BasicDataSourceFactory
url
jdbc:postgresql://127.0.0.1:5432/mze
driverClassName
org.postgresql.Driver
username
mze
password
mze
maxActive
20
maxIdle
10
maxWait
3000
-----------------------------------------------
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
Re: Same old story :( "Cannot load JDBC driver class 'null'"
От:
Dave Cramer <pg@fastcrypt.com>
Дата:
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:
> -----------------------------------------------
>
> "http://java.sun.com/dtd/web-app_2_3.dtd">
>
>
> ....
> ....
>
>
> postgreSQL Connection
> jdbc/mze
> javax.sql.DataSource
> Container
>
>
> -----------------------------------------------
>
>
> 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):
> -----------------------------------------------
>
>
>
> debug="0"/>
>
>
>
> type="org.apache.catalina.UserDatabase"
> description="User database that can be updated and saved">
>
>
> factory
> org.apache.catalina.users.MemoryUserDatabaseFactory
>
>
> pathname
> conf/tomcat-users.xml
>
>
>
>
>
>
>
> port="4444" minProcessors="5" maxProcessors="75"
> enableLookups="true" redirectPort="8443"
> acceptCount="100" debug="0" connectionTimeout="20000"
> useURIValidationHack="false" disableUploadTimeout="true" />
>
>
> port="8009" minProcessors="5" maxProcessors="75"
> enableLookups="true" redirectPort="8443"
> acceptCount="10" debug="0" connectionTimeout="0"
> useURIValidationHack="false"
> protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
>
>
>
>
>
> prefix="catalina_log." suffix=".txt"
> timestamp="true"/>
>
>
> debug="0" resourceName="UserDatabase"/>
>
>
> autoDeploy="true">
>
> directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>
>
>
> crossContext="true">
> prefix="localhost_examples_log." suffix=".txt" timestamp="true"/>
> home="com.wombat.empl.EmployeeRecordHome"
> remote="com.wombat.empl.EmployeeRecord"/>
>
>
> override="false"/>
>
> type="javax.sql.DataSource"/>
>
> usernamesa
> password
>
> driverClassNameorg.hsql.jdbcDriver
>
> urljdbc:HypersonicSQL:database
>
>
>
>
>
> mail.smtp.hostlocalhost
>
>
> global="simpleValue"
> type="java.lang.Integer"/>
>
>
>
> reloadable="true" crossContext="true">
>
>
>
>
>
> factory
> org.apache.commons.dbcp.BasicDataSourceFactory
>
>
> url
> jdbc:postgresql://127.0.0.1:5432/mze
>
>
> driverClassName
> org.postgresql.Driver
>
>
> username
> mze
>
>
> password
> mze
>
>
> maxActive
> 20
>
>
> maxIdle
> 10
>
>
> maxWait
> 3000
>
>
>
>
>
>
>
>
> -----------------------------------------------
>
> 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
Re: Same old story :( "Cannot load JDBC driver class 'null'"
От:
"Matthias Vach" <matthias.vach@web.de>
Дата:
Hi, Dave, i´ve read this document and i did it like the document says. except two little things: - i made a new because the exsisting context-tag bases on the Tomcat/examples-directory and my application is not lying there. My tag: - i do not have the parameter: validationQueryselect version(); but this can´t be the problem bacause + i read a lot and this is the first time i read about these parameter so i think its optional. + if this would be the problem, then the Exception would be an other. Thank you Matthias pg@fastcrypt.com schrieb am 03.03.04 17:29:47: > > Matthias, > > Have you read this ? > http://doc.postgresintl.com/jdbc/ch11s04.html > > If it still doesn't work let me know. > > Dave ______________________________________________________________________ Extra-Konto: 2,50 %* Zinsen p. a. ab dem ersten Euro! Nur hier mit 25 Euro-Tankgutschein & ExtraPrämie! https://extrakonto.web.de/?mc=021110
Re: Same old story :( "Cannot load JDBC driver class 'null'"
От:
Paul Thomas <paul@tmsl.demon.co.uk>
Дата:
On 03/03/2004 15:26 Matthias Vach wrote: > [snip] > reloadable="true" crossContext="true"> You don't need /webapps as part of your path. -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+
Re: Same old story :( "Cannot load JDBC driver class 'null'"
От:
Dave Cramer <pg@fastcrypt.com>
Дата:
Matthias, Can you send me your xml file ? Dave On Thu, 2004-03-04 at 05:23, Matthias Vach wrote: > Hi, Dave, > > i´ve read this document and i did it like the document says. > > except two little things: > - i made a new because the exsisting context-tag bases on the Tomcat/examples-directory and my application is not lying there. > My tag: > > > - i do not have the parameter: > validationQueryselect version(); > > but this can´t be the problem bacause > + i read a lot and this is the first time i read about these parameter so i think its optional. > + if this would be the problem, then the Exception would be an other. > > Thank you > Matthias > > > pg@fastcrypt.com schrieb am 03.03.04 17:29:47: > > > > Matthias, > > > > Have you read this ? > > http://doc.postgresintl.com/jdbc/ch11s04.html > > > > If it still doesn't work let me know. > > > > Dave > ______________________________________________________________________ > Extra-Konto: 2,50 %* Zinsen p. a. ab dem ersten Euro! Nur hier mit 25 > Euro-Tankgutschein & ExtraPrämie! https://extrakonto.web.de/?mc=021110 > -- Dave Cramer 519 939 0336 ICQ # 14675561