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): ----------------------------- <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false" deployOnStarup="true" xmlValidation="false" xmlNamespaceAware="false"> <Context docBase="jndistring.war" path="jndistring" useNaming="true"> <Environment name="teststring" value="a test value" type="java.lang.String" override="false" /> </Context> </Host> 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 <env-entry/> (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 <Host/>, <Context/> and <Environment/> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]