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

http://issues.apache.org/bugzilla/show_bug.cgi?id=34111

           Summary: globalnamingesources environment not working
           Product: Tomcat 4
           Version: 4.1.31
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


I looked everywhere. No one appears to be using this feature and it appears to
not be working as advertised. If I put a environment element in the
globalnamingresources, it doesn't show up in a webapp. 

I shouldn't need to use a ResourceLink. 

Using the environment variable given in the server.xml:

<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

Code snippet to access it:

  public void service(HttpServletRequest req, HttpServletResponse res)
  //  public void secureService(HttpServletRequest req, HttpServletResponse res,
User user)

        throws ServletException ,IOException{
        
        Context x = null;
        Context x2 = null;
        Integer env = null;
        try {
                x = new InitialContext();
        } catch (Exception ex) {System.out.println("error on x");}
        try {
                x2 = (Context) x.lookup("java:comp/env");
                NamingEnumeration enum = x.list("java:comp/env");
                // simpleValue should show up here, but it doesn't
                while (enum.hasMore()) {
                        System.out.println("env var: " + 
enum.next().toString());
                }
        } catch (Exception ex) {System.out.println("error on x2");}
        try {
                env = (Integer) x2.lookup("simpleValue");
                try {
                        System.out.println("env var:" + env.toString());
                } catch (Exception ex) {System.out.println("error on env 
print");}
        } catch (Exception ex) {System.out.println("error on env" + 
ex.toString());}

Tomcat Error:

error on envjavax.naming.NameNotFoundException: Name simpleValue is not bound in
 this Context

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to