Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 34993 invoked from network); 5 Apr 2006 03:23:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Apr 2006 03:23:46 -0000 Received: (qmail 9570 invoked by uid 500); 5 Apr 2006 03:23:35 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 9060 invoked by uid 500); 5 Apr 2006 03:23:34 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 9045 invoked by uid 99); 5 Apr 2006 03:23:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Apr 2006 20:23:33 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of amilasuriarachchi@gmail.com designates 66.249.82.193 as permitted sender) Received: from [66.249.82.193] (HELO xproxy.gmail.com) (66.249.82.193) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Apr 2006 20:23:31 -0700 Received: by xproxy.gmail.com with SMTP id t16so1138215wxc for ; Tue, 04 Apr 2006 20:23:11 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=coMgq1L2myjQwOQeidjd4m6a/B8WDf8XEzB6xcPWi1UA5EDh1RPDmMNOEy7luGtrmLVQOfHbYNCdDCgbA24pJrWxMoismGSjv7sf5il7oAmSNVExvX2tPO4rwgdu10EiCFGfiNXTgkDouM3ubvTro8Ld7NK6LPHAc+ECSsKCWKw= Received: by 10.70.62.10 with SMTP id k10mr4682093wxa; Tue, 04 Apr 2006 20:23:10 -0700 (PDT) Received: by 10.70.109.8 with HTTP; Tue, 4 Apr 2006 20:23:10 -0700 (PDT) Message-ID: <60708f4b0604042023kb1af139o93695ba8247eeae9@mail.gmail.com> Date: Wed, 5 Apr 2006 09:23:10 +0600 From: "Amila Suriarachchi" To: "Tomcat Users List" Subject: Re: PostgreSQL access via JNDI In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10457_22171281.1144207390768" References: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_10457_22171281.1144207390768 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 4/5/06, Mark Slater wrote: > > I've been trying to get PostgreSQL set up to be accessed through JNDI > in Tomcat 5.5.x. I found the docs page describing it, "jndi- > datasource-examples-howto.html", and followed the example there, but > it still doesn't work. I'm trying to provide access to PostgreSQL for > use by both JDO and JCR in my web-apps. > > Here's the Resource definition I'm using: > > auth=3D"Container" > type=3D"javax.sql.Datasource" > driverClassName=3D"org.postgresql.Driver" > url=3D"jdbc:postgresql://127.0.0.1:5432/my_db" this is a postgres problem rather than tomcat problem. try here jdbc:postgresql://localhost:5432/my_db (or template1) if you want to access the database giving 127.0.0.1 you have to put an entry in pg_hda.conf file. username=3D"-------------------" > password=3D"-------------------"" > maxActive=3D"10" > maxIdle=3D"100" > maxWait=3D"3000" /> > > > In my application's META-INF/context.xml, I have the following > ResourceLink: > > global=3D"jdbc/whisper_db" name=3D"jdbc/whisper_orm" > type=3D"javax.sql.Datasource" /> > > In my application's WEB-INF/web.xml, I have the following resource- > env-ref: > > > Whisper's Database > jdbc/whisper_orm > javax.sql.Datasource ref-type> > > > > Depending on where I put the Resource definition, I get different > errors. > > If I put it in the web-app's META-INF/context.xml, or in $TOMCAT_HOME/ > conf/context.xml, my JDO implementation complains: > NestableRuntimeException: There was an error duing JNDI lookup > of the name "java:comp/env/jdbc/whisper_orm". > .... > Caused by: javax.naming.NameNotFoundException: Name jdbc is not > bound in this Context > > If I put it in $TOMCAT_HOME/conf/server.xml, in the > GlobalNamingResources section, I get: > > 2006-04-04 11:58:27,866 ERROR > [org.apache.catalina.mbeans.GlobalResourcesLifecycleListener] - > > javax.naming.NamingException: Cannot create resource instance > at > org.apache.naming.factory.ResourceFactory.getObjectInstance > (ResourceFactory.java:132) > at javax.naming.spi.NamingManager.getObjectInstance > (NamingManager.java:304) > at org.apache.naming.NamingContext.lookup(NamingContext.java: > 792) > at org.apache.naming.NamingContext.lookup(NamingContext.java: > 152) > at > org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans > (GlobalResourcesLifecycleListener.java:138) > at > org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans > (GlobalResourcesLifecycleListener.java:143) > at > org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans > (GlobalResourcesLifecycleListener.java:108) > at > org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEve > nt(GlobalResourcesLifecycleListener.java:80) > at > org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent > (LifecycleSupport.java:119) > at org.apache.catalina.core.StandardServer.start > (StandardServer.java:693) > at org.apache.catalina.startup.Catalina.start(Catalina.java: > 551) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke > (NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at org.apache.catalina.startup.Bootstrap.start > (Bootstrap.java:275) > at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java: > 413) > > I'm assuming these errors are related, and that whatever is causing > the NamingException is the same fundamental problem causing the > NameNotFoundException in the context-based configuration. My problem > is that I can't figure out what it is. The driver for the database > (postgresql-8.1-405.jdbc3.jar) is in $TOMCAT_HOME/common/lib/, and > I've also tried adding commons-dbcp-1.2.1.jar and commons- > pool-1.2.jar alongside it (even though the docs say that shouldn't be > necessary), but get the same errors. > > Is there any logging that I can turn on that will tell me the WHY > Tomcat "Cannot create resource instance"? Or am I doing something > obviously stupid with my Resource definition? Or could it be > something else entirely? > > Any suggestions would be really helpful. > > Thanks! > > Mark > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > ------=_Part_10457_22171281.1144207390768--