Skip site navigation (1) Skip section navigation (2)

Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"

From: Lew <noone(at)lewscanon(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"
Date: 2010-06-05 13:20:55
Message-ID: hudivk$b2h$1@news.albasani.net (view raw or flat)
Thread:
Lists: pgsql-jdbc
philfrei(at)aol(dot)com wrote:
>> There is no .WAR file in this project. So I am unable to follow
>> related advice.

John R Pierce wrote:
> why not ? a .war file is the standard method of deploying a tomcat app.

My guess is that the OP didn't build the project, then.

> its a renamed .zip file that contains the project jars, xml manifest,
> related libraries, etc etc. to deploy the app (or an update) you simply
> drop the .war into the deployment dir, and tomcat sees it and unzips it
> into the /webapps/appname/ folder and off it goes

philfrei(at)aol(dot)com wrote:
>> There is a .CLASSPATH file stored with the project.

It's actually a ".classpath" file.  This is an Eclipse-specific file and only 
instructs Eclipse how to set the classpath.  It does not itself set the classpath.

The classpath for a web app is entirely under the programmer's control and 
depends on putting the driver JAR in the WAR.  The entry in the Eclipse 
metafiles directs Eclipse to do that for you.

>> It has the following entry pertaining to the jdbc:
>> <classpathentry kind="con"
>> path="org.eclipse.datatools.connectivity.jdt.DRIVERLIBRARY/PostgreSQL JDBC Driver"/>

I find it convenient to do as Manohar suggested, "simply putting the jar file 
in [the $]CATALINA_HOME/lib/ directory", because typically if one app needs to 
access a particular database then many if not all apps in that app server will 
need access to the same driver.  It's only truly necessary if Tomcat itself 
needs that driver, e.g., to handle authentication.  Otherwise it should 
suffice to put the JAR in the "WEB-INF/lib/" directory of the deployed app 
(i.e., the WAR file).

philfrei, you do have a WAR file if you're deploying a web app.  You must be 
looking in the wrong place.  Into what directory does Eclipse put its built files?

Also, did you read the Tomcat documentation?  I posted a couple of relevant 
links upthread.

-- 
Lew

In response to

pgsql-jdbc by date

Next:From: LewDate: 2010-06-05 23:13:34
Subject: Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"
Previous:From: Manohar BhattaraiDate: 2010-06-05 11:31:35
Subject: Re: Not able to connect to postgresql database

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group