webtier@glassfish.java.net

Can't seem to look up a env-entry

From: <webtier_at_javadesktop.org>
Date: Thu, 06 Nov 2008 15:09:54 PST

I have this piece of code:
[code]
        String configFile = null;
        try {
            Context env = (Context) new InitialContext().lookup("java:comp/env");
            configFile = (String) env.lookup("config-path");
        } catch (NamingException ex) {
            Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex);
        }
        return configFile;
[/code]

I have this in my web.xml.

[code]
    <env-entry>
        <env-entry-name>config-path</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-type>
        <env-entry-value>/hoss-config.xml</env-entry-value>
    </env-entry>
[/code]

and when I call that code, I get:

javax.naming.NamingException: invocation exception
        at com.sun.enterprise.naming.NamingManagerImpl.getComponentId(NamingManagerImpl.java:1332)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:827)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:351)

What's most annoying is that this "worked before", and "now it doesn't". :-/

Any hints? (Source was no help, it's just telling me that there's "no container context", which doesn't explain WHY there is no container context).

Anyway, GFv2r2 Windows JDK 5.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=315363