Re: Datasource and tomcat, Postgresql 7.4, jkd1.4.1 - Mailing list pgsql-jdbc

From Vernon Wu
Subject Re: Datasource and tomcat, Postgresql 7.4, jkd1.4.1
Date
Msg-id IC6195SN081XRNKHKJAC8ZR87LJV.3e487b2a@kimiko
Whole thread Raw
In response to Datasource and tomcat, Postgresql 7.4, jkd1.4.1  (GB Clark <postgres@vsservices.com>)
Responses Re: Datasource and tomcat, Postgresql 7.4, jkd1.4.1 --  (GB Clark <postgres@vsservices.com>)
List pgsql-jdbc
Have you check the driver to see whether it is in your class path? You can have the driver in several places

<your-app>/WEB-INF/lib
<TC>/common/lib

Either location is a good place to have the tar ball.


10/02/2003 5:00:12 PM, GB Clark <postgres@vsservices.com> wrote:

>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@VSServices.COM | General Geek
>           CTHULU for President - Why choose the lesser of two evils?
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>




pgsql-jdbc by date:

Previous
From: Vernon Wu
Date:
Subject: Re: Is a right behaviour on inserting a duplicate key?
Next
From: GB Clark
Date:
Subject: Re: Datasource and tomcat, Postgresql 7.4, jkd1.4.1 --