Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C2B176322ED for ; Fri, 4 Jun 2010 02:48:47 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 52284-03 for ; Fri, 4 Jun 2010 05:48:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from imr-da04.mx.aol.com (imr-da04.mx.aol.com [205.188.105.146]) by mail.postgresql.org (Postfix) with ESMTP id 615436321A7 for ; Fri, 4 Jun 2010 02:48:40 -0300 (ADT) Received: from imo-ma02.mx.aol.com (imo-ma02.mx.aol.com [64.12.78.137]) by imr-da04.mx.aol.com (8.14.1/8.14.1) with ESMTP id o545mUob016496; Fri, 4 Jun 2010 01:48:30 -0400 Received: from PhilFrei@aol.com by imo-ma02.mx.aol.com (mail_out_v42.9.) id g.dc9.a0c2216 (45326); Fri, 4 Jun 2010 01:48:20 -0400 (EDT) Received: from smtprly-ma01.mx.aol.com (smtprly-ma01.mx.aol.com [64.12.207.140]) by cia-mc05.mx.aol.com (v129.4) with ESMTP id MAILCIAMC052-5c444c0893a3206; Fri, 04 Jun 2010 01:48:20 -0400 Received: from webmail-d048 (webmail-d048.sim.aol.com [205.188.167.92]) by smtprly-ma01.mx.aol.com (v129.4) with ESMTP id MAILSMTPRLYMA012-5c444c0893a3206; Fri, 04 Jun 2010 01:48:20 -0400 X-MB-Message-Type: User Content-Type: text/plain; charset="utf-8"; format=flowed Cc: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Received: from 69.228.198.50 by webmail-d048.sysops.aol.com (205.188.167.92) with HTTP (WebMailUI); Fri, 04 Jun 2010 01:48:20 -0400 To: craig@postnewspapers.com.au X-AOL-IP: 69.228.198.50 References: <8CCD02714A2791E-E2C-7A83@webmail-m042.sysops.aol.com> <4C05F409.7060805@postnewspapers.com.au> <8CCD0CAC9B7220C-D8C-4F1C@webmail-d098.sysops.aol.com> <4C071135.3020607@postnewspapers.com.au> Date: Fri, 04 Jun 2010 01:48:20 -0400 From: philfrei@aol.com Content-Transfer-Encoding: quoted-printable Subject: Re: jdbc works in java app, fails in servlet: "no suitable jdbc found" X-MB-Message-Source: WebUI X-Mailer: AOL Webmail 31793-STANDARD In-Reply-To: <4C071135.3020607@postnewspapers.com.au> Message-Id: <8CCD1C0ABE41498-C10-62A5@webmail-d048.sysops.aol.com> X-AOL-SENDER: PhilFrei@aol.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.79 tagged_above=-10 required=5 tests=BAYES_50=0.8, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/38 X-Sequence-Number: 20608 HI - Thank you both Craig and Manohar. There is no .WAR file in this project. So I am unable to follow related=20 advice. There is a .CLASSPATH file stored with the project. It has the=20 following entry pertaining to the jdbc: There is also a .project file with various and=20 tags, and a .jsdtscope file with and=20 tags. But neither has any reference to the JDBC. I'm thinking maybe I will refer back to the Eclipse Forum with this=20 research, as they will may know better if the registration is correct=20 and proper. If I do get an answer, I will follow up here just in case anyone else=20 ends up pursuing the same matter. With much appreciation, Phil Freihofner -----Original Message----- From: Craig Ringer To: philfrei@aol.com Cc: pgsql-jdbc@postgresql.org Sent: Wed, Jun 2, 2010 7:19 pm Subject: Re: jdbc works in java app, fails in servlet: "no suitable=20 jdbc found" On 3/06/2010 8:28 AM, philfrei@aol.com wrote:=C2=A0 > Thank you for the reply!=C2=A0 >=C2=A0 >> You need to preload the PostgreSQL driver...=C2=A0 >=C2=A0 > Being new to this, I find myself second-guessing words as simple as=C2= =A0 > "preload". The servlet "NearbyTest" has a constructor and a single=C2=A0 > method "doGet" which is invoked by an HTML page. As the first working=C2= =A0 > statement in the "doGet" method (at this point everything else is=C2=A0 > commented out), I tried using the recommended statements. Both of=20 them=C2=A0 > elicited the same error message:=C2=A0 >=C2=A0 > try {=C2=A0 > // Class.forName("org.postgresql.Driver");=C2=A0 > this.getClass().getClassLoader().loadClass("org.postgresql.Driver");=C2= =A0 > } catch (ClassNotFoundException e1) {=C2=A0 > e1.printStackTrace();=C2=A0 > }=C2=A0 >=C2=A0 > java.lang.ClassNotFoundException: org.postgresql.Driver=C2=A0 =C2=A0 I'd say your classpath is misconfigured; the classloader cannot find=20 PostgreSQL.=C2=A0 =C2=A0 On web service containers sometimes the dependencies for the servelet=20 must all be embedded in a .war with the serverlet jar. Is that the case=20 here?=C2=A0 =C2=A0 > Is there another stage (prior to the servlet's=C2=A0 > "doGet") at which the "preloading" should occur?=C2=A0 =C2=A0 Nope, just loading the class is sufficient.=C2=A0 =C2=A0 > The stack trace indicates code that is part of Apache. Is there=20 possibly=C2=A0 > something that has to be configured in Apache that is missing?=C2=A0 =C2=A0 Well the trace refers to org.apache.catalina.loader.WebappClassLoader ,=20 which is a part of Apache Catalina. It has nothing to do with the=20 Apache web server except that they're both from the Apache project.=C2=A0 =C2=A0 Catalina is Tomcat's servlet container.=C2=A0 =C2=A0 That further suggests that you need to configure your classpath in your=20 web app environment, or have an issue with how your app and=20 dependencies are packaged. I've only done this stuff with Maven &=20 Netbeans targeting Glassfish, so I can't really offer much help with=20 the details of doing it right using Eclipse's build system and a Tomcat=20 target.=C2=A0 =C2=A0 --=C2=A0 Craig Ringer=C2=A0