Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 3112 invoked from network); 3 Sep 2008 13:43:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Sep 2008 13:43:25 -0000 Received: (qmail 60499 invoked by uid 500); 3 Sep 2008 13:43:10 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 60450 invoked by uid 500); 3 Sep 2008 13:43:10 -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 60426 invoked by uid 99); 3 Sep 2008 13:43:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Sep 2008 06:43:10 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sip.sniffa@gmail.com designates 64.233.184.231 as permitted sender) Received: from [64.233.184.231] (HELO wr-out-0506.google.com) (64.233.184.231) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Sep 2008 13:42:12 +0000 Received: by wr-out-0506.google.com with SMTP id c57so2607322wra.4 for ; Wed, 03 Sep 2008 06:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=SBH7B84OrPSVYeyCegaNwutO9SzsrSP3toAYkv+eyo4=; b=GDYR+BwD12pOYWxPICcYVjHLqzlCFd5Ue5crMwUy4BM9s8zn0Y22HNiV4Dwqt3Nbo/ Zdwwzkt+5ka33QJiJJF11SxkMLFVBJ5iEqLF2Cck8DNovohl4wiZj2r+YKzjKtJon8e1 mVi1Y9sWovNuAVZ7p3+q7Dt3ih1HwzJbCN4XA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=f0L+Yd+Ywecwo0N7pXmtp+VbbWmAOp1zBpfgiFytWTLzJJgH/39gdjCvWIbN8S0KAK YymJTEbkzm+2nTGo8REMCRawme20lLau0RClH7JhWrn9OXz/cz31+5WvpCHQlBoDTin6 ZXopvHgKSL2e3XjGH2Jm1//QUzIA1/fckEZtw= Received: by 10.90.101.7 with SMTP id y7mr11409551agb.13.1220449344734; Wed, 03 Sep 2008 06:42:24 -0700 (PDT) Received: by 10.90.118.17 with HTTP; Wed, 3 Sep 2008 06:42:24 -0700 (PDT) Message-ID: Date: Wed, 3 Sep 2008 14:42:24 +0100 From: "Paul Pepper" To: "Tomcat Users List" Subject: Re: Problem with JNDI environment entry resources In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org Martin, Thanks for the suggestion, though I think there may have been some misunderstanding. I'm attempting to access a simple java.lang.String, not a DataSource. elements are used to place String resources in an application's environment, not elements, AFAIK. Paul. 2008/9/3 Martin Gainty : > > 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="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> version="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
> ______________________________________________ > Disclaimer and confidentiality note > Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > > >> Date: Wed, 3 Sep 2008 01:01:40 +0100 >> From: sip.sniffa@gmail.com >> To: users@tomcat.apache.org >> Subject: Problem with JNDI environment entry resources >> >> Tomcat 6.0.18 >> java version "1.6.0_06" (sun-java6-jdk on Ubuntu 8.04 i386) >> >> I'm attempting to create environment entry resources, of type >> java.lang.String, within conf/server.xml and access them from web >> applications using JNDI. I've created a bare-bones test web app, >> jndistring, with the following conf/server.xml configuration: >> >> server.xml (snipped): >> ----------------------------- >> > appBase="webapps" >> unpackWARs="true" >> autoDeploy="false" >> deployOnStarup="true" >> xmlValidation="false" >> xmlNamespaceAware="false"> >> >> > path="jndistring" >> useNaming="true"> >> >> > value="a test value" >> type="java.lang.String" >> override="false" >> /> >> >> >> >> >> For the purpose of this test I've used jsp to access the value of teststring. >> >> jndistring.jsp (snipped): >> -------------------------------- >> <% >> Context initCtx = new InitialContext(); >> Context envCtx = (Context) initCtx.lookup("java:comp/env"); >> >> String teststring = (String) envCtx.lookup("teststring"); >> out.println("teststring: " + teststring); >> %> >> >> Accessing this page throws an exception: >> org.apache.jasper.JasperException: An exception occurred processing >> JSP page /test.jsp at line 18 >> 15: Context initCtx = new InitialContext(); >> 16: Context envCtx = (Context) initCtx.lookup("java:comp/env"); >> 17: >> 18: String teststring = (String) envCtx.lookup("teststring"); >> 19: out.println("teststring: " + teststring); >> 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 >> >> If I attempt to create an environment entry resource using >> (and sub-elements) within web.xml, then the resource is >> created and I can access it!!! >> >> I've read the "JNDI resources howto", docs regarding the , >> and elements (and others), but don't see >> that I have missed anything. >> >> Can anyone suggest what I might have missed? Has anyone else had >> similar problems? >> >> Thanks, >> >> Paul. >> >> --------------------------------------------------------------------- >> To start a new topic, e-mail: users@tomcat.apache.org >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >> For additional commands, e-mail: users-help@tomcat.apache.org >> > > _________________________________________________________________ > Get thousands of games on your PC, your mobile phone, and the web with Windows(R). > http://clk.atdmt.com/MRT/go/108588800/direct/01/ --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org