Re: Tomcat - PostgreSQL - Cannot load JDBC driver class "null"

From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: CRAIG GOLBY <craig(at)golby(dot)me(dot)uk>
Cc: "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Tomcat - PostgreSQL - Cannot load JDBC driver class "null"
Date: 2003-09-27 09:23:43
Message-ID: 20030927102343.A3974@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


On 26/09/2003 17:29 CRAIG GOLBY wrote:
> [snip]
> public void init() {
> try{
> Context ctx = new InitialContext();
> if(ctx == null )
> throw new Exception("Boom - No Context");
> status = "checking CTX";
>
> DataSource ds =
> (DataSource)ctx.lookup("java:comp/env/jdbc/PersonalDb");
> status = "Completing Lookup of CTX";
>
> if (ds != null)
> {
> status = "Creating Connection";
> Connection conn = ds.getConnection(); <----- FAILS HERE

With a NullPointerException I presume? Try

DataSource ds =
(DataSource)ctx.lookupLink("java:comp/env/jdbc/PersonalDb");

And rememeber that the JDBC driver _must_ be in common/lib and _must not_
be in the classpath.

HTH

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Peter Eisentraut 2003-09-27 09:31:04 Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)
Previous Message Oliver Elphick 2003-09-27 05:55:49 Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)