You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/01/15 18:04:37 UTC

DO NOT REPLY [Bug 16116] New: - ResourceLink does not work within DefaultContext

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16116>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16116

ResourceLink does not work within DefaultContext

           Summary: ResourceLink does not work within DefaultContext
           Product: Tomcat 4
           Version: 4.1.19
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina:Modules
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: kris@dotech.com
                CC: kris@dotech.com


Given the (condensed) server.xml snippet:

<Server port="8005" shutdown="SHUTDOWN" debug="0">
  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
  </GlobalNamingResources>
  <Service name="Tomcat-Standalone">
    <Engine name="Standalone" defaultHost="localhost" debug="0">
      <DefaultContext>
        <ResourceLink name="defaultSimpleValue"
                      global="simpleValue"
                      type="java.lang.Integer"/>
      </DefaultContext>
...

With a test JSP:

<%@ page contentType="text/plain"
         import="java.io.*,javax.naming.*" %>

<%
Context ctx = null;
try {
    ctx = new InitialContext();
    Integer defaultSimpleValue =
(Integer)ctx.lookup("java:comp/env/defaultSimpleValue");
    out.println("defaultSimpleValue = " + defaultSimpleValue);
} catch (Exception exc) {
    exc.printStackTrace(new PrintWriter(out));
} finally {
    if (ctx != null) {
        try {
            ctx.close();
        } catch (NamingException exc) {
            exc.printStackTrace(new PrintWriter(out));
        }
    }
}
%>

Results in:

javax.naming.NameNotFoundException: Name defaultSimpleValue is not bound in this
Context

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>