Datasource and tomcat, Postgresql 7.4, jkd1.4.1

From: GB Clark <postgres(at)vsservices(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Datasource and tomcat, Postgresql 7.4, jkd1.4.1
Date: 2003-02-11 01:00:12
Message-ID: 20030210190012.697a7b13.postgres@vsservices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I'm trying to get the jdbc interface working with datasources and just can't seem to
get it. It works fine with the plain driver.

The error I'm getting is
java.sql.SQLException: Cannot load JDBC driver class 'null'

Here is the stack trace:
java.sql.SQLException: Cannot load JDBC driver class 'null' at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312) at testme.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke!
(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core!
.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.cata
lina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530) at java.lang.Thread.run(Thread.java:536)

And here is my code:
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/postgresql");
Connection connection = ds.getConnection(); <-- This is where it fails.

Here are some .xml things
<ResourceParams name="jdbc/postgresql">
<parameter>
<name>validationQuery</name>
<value></value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:postgresql://prime.vsservices.com:5432/gclarkii</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<parameter>
<name>maxActive</name>
<value>2</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.postgresql.jdbc2.optional.SimpleDataSource</value>
</parameter>
<parameter>
<name>username</name>
<value>gclarkii</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>6</value>
</parameter>
</ResourceParams>

And
<resource-ref>
<description>postgreSQL Datasource</description>
<res-ref-name>jdbc/postgresql</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

I'm fairly new to java but have a good background in C++ and Perl.

Any ideas on where to look?

thanks,

GB

--
GB Clark II | Roaming FreeBSD Admin
gclarkii(at)VSServices(dot)COM | General Geek
CTHULU for President - Why choose the lesser of two evils?

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vernon Wu 2003-02-11 04:18:20 Re: Is a right behaviour on inserting a duplicate key?
Previous Message David Wall 2003-02-10 23:54:45 Re: create BLOB question