Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 19912 invoked from network); 17 Jun 2003 23:03:29 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 17 Jun 2003 23:03:29 -0000 Received: (qmail 28579 invoked by uid 97); 17 Jun 2003 23:05:54 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 28572 invoked from network); 17 Jun 2003 23:05:54 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 17 Jun 2003 23:05:54 -0000 Received: (qmail 18400 invoked by uid 500); 17 Jun 2003 23:03:16 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 18386 invoked from network); 17 Jun 2003 23:03:15 -0000 Received: from anchor-post-39.mail.demon.net (194.217.242.80) by daedalus.apache.org with SMTP; 17 Jun 2003 23:03:15 -0000 Received: from safehaven.demon.co.uk ([62.49.28.28] helo=server) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 19SPU2-0004WN-0U for tomcat-user@jakarta.apache.org; Wed, 18 Jun 2003 00:03:22 +0100 Received: from 192.168.0.7 by server ([192.168.0.8] running VPOP3) with ESMTP for ; Wed, 18 Jun 2003 00:41:44 +0100 Message-ID: <3EEF9F0D.6040701@everserve.co.uk> Date: Wed, 18 Jun 2003 00:06:53 +0100 From: Tim Shaw User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Tomcat/Ant/JNDI question References: <9C5166762F311146951505C6790A9CF8A6E700@US-VS1.corp.mpi.com> <3EEF7D3F.9080007@lvcm.com> <3EEF8D93.6050800@everserve.co.uk> <3EEF947A.2010406@lvcm.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Server: VPOP3 V1.5.0b - Registered X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N The Resource is specified, in the server.xml, with a name. This is the JNDI name and is used to refer to the resource from wherever you like. The setup of the resource is done by the ResourceParams (I hope you didn't copy my example verbatim ;-) The web.xml is just abstracting that reference for a lower-level JNDI call. If you are now getting a null connection, the basic JNDI aspect is (probably) working ... and you just need to figure out the url/DB specific stuff. This could be the Factory (I added that param based on the JNDI/JDBC HOWTO - but it worked fine before, so it might be a default), DB permissions (grabbing a connection can fail in loadsa ways!), or ... If you have coded the JNDI (InitialContext) lookup correctly it will work. BTW I got badly bitten with 4.1.2 (haven't checked since) - every time I redeployed my app it rewrote the server.xml file (removing my Resource definitions). If you're still stuck, some more info is needed - server.xml/web.xml snippets and code where you get the ref and the connection for starters. G'luck tim Garrett Dangerfield wrote: > I tried this and it's not giving me the "not found in Context" message, > but it's now trying to pass me a null connection. > > I think the problem is that it doesn't know where to get the connection > from. > > With the ResourceLink in the server.xml Context, one specifies the name > one wants to use locally as well as the name of the global resource. The > resource-ref doesn't allow this. > > Any further thoughts? > > Thanks, > Garrett Dangerfield. > > Tim Shaw wrote: > >> This works for me ... >> >> web.xml : >> >> >> Resource reference to a factory for java.sql.Connection >> instances that may be used for talking to a particular >> database that is configured in the server.xml file. >> >> >> jdbc/SessionDB >> >> >> javax.sql.DataSource >> >> >> Container >> >> >> >> context.xml : >> >> > type="javax.sql.DataSource"/> >> >> >> factory >> org.apache.commons.dbcp.BasicDataSourceFactory >> >> >> >> username >> tripleplay >> >> >> password >> >> >> >> driverClassName >> com.mysql.jdbc.Driver >> >> >> url >> jdbc:mysql://vodmgr:3306/tripleplay >> >> >> maxActive >> 20 >> >> >> maxIdle >> 20 >> >> >> maxWait >> 5000 >> >> >> >> >> Garrett Dangerfield wrote: >> >>> I tried this and it's not working. >>> >>> It's saying: >>> Name jdbc not found in this context >>> >>> In my web.xml, I put in: >>> >>> >>> jdbc/DataWarehouse >>> jdbc/DataWarehouse >>> javax.sql.DataSource >>> >>> >>> In my server.xml, I have: >>> >>> >> type="javax.sql.DataSource"/> >>> >>> Am I missing something? >>> >>> Thanks >>> Garrett Dangerfield. >>> >>> Shapira, Yoav wrote: >>> >>>> Howdy, >>>> >>>> >>>> >>>>> - put the equivalent of ResourceEnvRef into the web.xml inside the web >>>> >>>> >>>> >>>> app >>>> >>>> See the element in the Servlet Specification, v2.3, >>>> SRC.13.1. >>>> >>>> Yoav Shapira >>>> >>>> >>>> >>>> This e-mail, including any attachments, is a confidential business >>>> communication, and may contain information that is confidential, >>>> proprietary and/or privileged. This e-mail is intended only for the >>>> individual(s) to whom it is addressed, and may not be saved, copied, >>>> printed, disclosed or used by anyone else. If you are not the(an) >>>> intended recipient, please immediately delete this e-mail from your >>>> computer system and notify the sender. Thank you. >>> >>> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org