users@glassfish.java.net

JNDI lookup of application name from embeddable Glassfish

From: <glassfish_at_javadesktop.org>
Date: Wed, 27 Oct 2010 12:59:45 PDT

Does the embeddable version of Glassfish support the global JNDI lookup name for the application name (java:app/AppName)? I always get a NamingException when I try using it. For example, using 3.0.1:

javax.naming.NamingException: Lookup failed for 'java:app/AppName' in SerialContext [Root exception is javax.naming.NamingException: Could not resolve java:app/AppName]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at com.example.Test.main(Test.java:18)
Caused by: javax.naming.NamingException: Could not resolve java:app/AppName
        at com.sun.enterprise.container.common.impl.JavaModuleNamingProxy.getAppName(JavaModuleNamingProxy.java:148)
        at com.sun.enterprise.container.common.impl.JavaModuleNamingProxy.handle(JavaModuleNamingProxy.java:100)
        at com.sun.enterprise.naming.impl.NamedNamingObjectManager.tryNamedProxies(NamedNamingObjectManager.java:84)
        at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:153)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:428)
        ... 3 more


And using 3.1-SNAPSHOT:

javax.naming.NamingException: Lookup failed for 'java:app/AppName' in SerialContext[targetHost=null,targetPort=null [Root exception is javax.naming.NamingException: Could not resolve java:app/AppName]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:561)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at com.example.Test.main(Test.java:18)
Caused by: javax.naming.NamingException: Could not resolve java:app/AppName
        at com.sun.enterprise.container.common.impl.JavaModuleNamingProxy.getAppName(JavaModuleNamingProxy.java:166)
        at com.sun.enterprise.container.common.impl.JavaModuleNamingProxy.handle(JavaModuleNamingProxy.java:118)
        at com.sun.enterprise.naming.impl.NamedNamingObjectManager.tryNamedProxies(NamedNamingObjectManager.java:88)
        at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:171)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:538)
        ... 4 more


Attached is a trivial example that makes use of the lookup (and fails due to the exception). Is this functionality not currently supported? If that is the case, are there any plans to support this? Thanks in advance!
[Message sent by forum member 'atomicknight']

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