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

From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: "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-29 07:53:03
Message-ID: 20030929085303.A18236@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


On 27/09/2003 10:23 Paul Thomas wrote:
>
> 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.

Whoops! Actually looking at source code instead relying on memory, that
should be something like

InitialContext cxt = new InitialContext();
Context ctx2 = (Context)ctx.lookup("java:comp/env");
DataSource ds = (DataSource)ctx2.lookupLink("jdbc/PersonalDb");

Which is the only way I could find which worked on Tomcat 4.1.12. I've
just retried this on 4.1.24

InitialContext cxt = new InitialContext();
DataSource ds =
(DataSource)ctx.lookup("java:comp/env/jdbc/PersonalDb");

and that works too so whatever the problem was on the older version seems
to have been fixed.

--
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

Browse pgsql-jdbc by date

  From Date Subject
Next Message Marco Vezzoli 2003-09-29 11:37:40 Re: Pgsql 7.3 JVM 1.1 driver missing
Previous Message sarathi 2003-09-28 14:14:53 Re: Tomcat - PostgreSQL - Perfomance Tuning