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

From GB Clark
Subject Re: Datasource and tomcat, Postgresql 7.4, jkd1.4.1 --
Date
Msg-id 20030211085638.694fcb1e.postgres@vsservices.com
Whole thread Raw
In response to Re: Datasource and tomcat, Postgresql 7.4, jkd1.4.1  (Vernon Wu <vernonw@gatewaytech.com>)
Responses Re: Datasource and tomcat, Postgresql 7.4, jkd1.4.1 --
List pgsql-jdbc
On Mon, 10 Feb 2003 20:25:14 -0800
Vernon Wu <vernonw@gatewaytech.com> wrote:

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

I would think that the system would die somewhere with a class not found instead of the can not load
'null' class, but I don't know.

At the bottom I've included more stuff.

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

I've changed this back to org.postgresql.Driver.  At this point I'm down to trying anything...

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

Well postgresql.jar (I've tried both the downloaded one and compiling one) is in TC/common/lib and
nowhere else (I do a classpath for my compiles).  Hummm... I also seem to be getting this error
when the servlet is loaded/reloaded:
2003-02-11 08:54:41 NamingContextListener[/Standalone/localhost/testme]: Failed to bind object:
javax.naming.NamingException:Name postgresql is already bound in this Context 

Arrrggghhhhhh

Thanks for the help.

GB

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

pgsql-jdbc by date:

Previous
From: Vernon Wu
Date:
Subject: Re: Datasource and tomcat, Postgresql 7.4, jkd1.4.1
Next
From: Jeremiah Jahn
Date:
Subject: Re: create BLOB question