Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 7538 invoked from network); 3 Sep 2008 00:36:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Sep 2008 00:36:25 -0000 Received: (qmail 86433 invoked by uid 500); 3 Sep 2008 00:36:11 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 86403 invoked by uid 500); 3 Sep 2008 00:36:11 -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 86392 invoked by uid 99); 3 Sep 2008 00:36:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Sep 2008 17:36:11 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mgainty@hotmail.com designates 65.55.111.112 as permitted sender) Received: from [65.55.111.112] (HELO blu0-omc2-s37.blu0.hotmail.com) (65.55.111.112) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Sep 2008 00:35:11 +0000 Received: from BLU142-W24 ([65.55.111.71]) by blu0-omc2-s37.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 2 Sep 2008 17:35:18 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_0b862c21-1262-4c9a-8126-e7cd8c056f7c_" X-Originating-IP: [24.34.14.214] From: Martin Gainty To: Tomcat Users List Subject: RE: Problem with JNDI environment entry resources Date: Tue, 2 Sep 2008 20:35:19 -0400 Importance: Normal In-Reply-To: References: MIME-Version: 1.0 X-OriginalArrivalTime: 03 Sep 2008 00:35:18.0986 (UTC) FILETIME=[F118DAA0:01C90D5C] X-Virus-Checked: Checked by ClamAV on apache.org --_0b862c21-1262-4c9a-8126-e7cd8c056f7c_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html=
/WEB-INF/web.xml contents which contain a jndi reference
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=3D"http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version=3D"2.4">
MySQL Test App

DB Connection
teststring
javax.sql.DataSource
Container


the lookup to teststring will get you a connection to the DB
HTH
Martin
______________________________________________=20 Disclaimer and confidentiality note=20 Everything in this e-mail and any attachments relates to the official busin= ess of Sender. This transmission is of a confidential nature and Sender doe= s not endorse distribution to any party other than intended recipient. Send= er does not necessarily endorse content contained within this transmission.= =20 > Date: Wed=2C 3 Sep 2008 01:01:40 +0100 > From: sip.sniffa@gmail.com > To: users@tomcat.apache.org > Subject: Problem with JNDI environment entry resources >=20 > Tomcat 6.0.18 > java version "1.6.0_06" (sun-java6-jdk on Ubuntu 8.04 i386) >=20 > I'm attempting to create environment entry resources=2C of type > java.lang.String=2C within conf/server.xml and access them from web > applications using JNDI. I've created a bare-bones test web app=2C > jndistring=2C with the following conf/server.xml configuration: >=20 > server.xml (snipped): > ----------------------------- > appBase=3D"webapps" > unpackWARs=3D"true" > autoDeploy=3D"false" > deployOnStarup=3D"true" > xmlValidation=3D"false" > xmlNamespaceAware=3D"false"> >=20 > path=3D"jndistring" > useNaming=3D"true"> >=20 > value=3D"a test value" > type=3D"java.lang.String" > override=3D"false" > /> > >=20 > >=20 > For the purpose of this test I've used jsp to access the value of teststr= ing. >=20 > jndistring.jsp (snipped): > -------------------------------- > <% > Context initCtx =3D new InitialContext()=3B > Context envCtx =3D (Context) initCtx.lookup("java:comp/env")=3B >=20 > String teststring =3D (String) envCtx.lookup("teststring")=3B > out.println("teststring: " + teststring)=3B > %> >=20 > Accessing this page throws an exception: > org.apache.jasper.JasperException: An exception occurred processing > JSP page /test.jsp at line 18 > 15: Context initCtx =3D new InitialContext()=3B > 16: Context envCtx =3D (Context) initCtx.lookup("java:comp/env")=3B > 17: > 18: String teststring =3D (String) envCtx.lookup("teststring")=3B > 19: out.println("teststring: " + teststring)=3B > 20: %> >=20 > The top frame of the root cause is shown as: > javax.servlet.ServletException: javax.naming.NameNotFoundException: > Name teststring is not bound in this Context >=20 > If I attempt to create an environment entry resource using > (and sub-elements) within web.xml=2C then the resource is > created and I can access it!!! >=20 > I've read the "JNDI resources howto"=2C docs regarding the =2C > and elements (and others)=2C but don't see > that I have missed anything. >=20 > Can anyone suggest what I might have missed? Has anyone else had > similar problems? >=20 > Thanks=2C >=20 > Paul. >=20 > --------------------------------------------------------------------- > To start a new topic=2C e-mail: users@tomcat.apache.org > To unsubscribe=2C e-mail: users-unsubscribe@tomcat.apache.org > For additional commands=2C e-mail: users-help@tomcat.apache.org >=20 _________________________________________________________________ Get thousands of games on your PC=2C your mobile phone=2C and the web with = Windows=AE. http://clk.atdmt.com/MRT/go/108588800/direct/01/= --_0b862c21-1262-4c9a-8126-e7cd8c056f7c_--