users@glassfish.java.net

Re: Glassfish application-name and JNDI

From: <glassfish_at_javadesktop.org>
Date: Wed, 17 Feb 2010 06:59:26 PST

Your application.xml looks fine to me. But I tried a small test case from my side and seems things are working as expected for me. I have a simple ear which contains a war and an ejb jar.

I first deployed it without using the application-name element, and the application was deployed under the default name (ear name minus suffix), and the portable JNDI name for ejb seems to using that name:

$ asadmin deploy ~/deployment/apps/stateless-simple.ear
Application deployed successfully with name stateless-simple.

In the server.log: #|2010-02-17T09:47:10.740-0500|INFO|glassfishv3.0|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=23;_ThreadName=Thread-1;|Portable JNDI names for EJB TheGreeter : [java:global/stateless-simple/stateless-simpleEjb/TheGreeter, java:global/stateless-simple/stateless-simpleEjb/TheGreeter!samples.ejb.stateless.simple.ejb.GreeterHome]|#]

Then I edited the application.xml use the "foo" for application-name, now:
$ asadmin deploy ~/deployment/apps/stateless-simple-app-name.ear
Application deployed successfully with name foo.

The application is deployed under the name "foo".

And in the server.log, I got this for EJB JNDI name now:
[#|2010-02-17T09:47:48.530-0500|INFO|glassfishv3.0|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=24;_ThreadName=Thread-1;|Portable JNDI names for EJB TheGreeter : [java:global/foo/stateless-simpleEjb/TheGreeter!samples.ejb.stateless.simple.ejb.GreeterHome, java:global/foo/stateless-simpleEjb/TheGreeter]|#]

Can you check what name the application is deployed with in your case (check the statement "Application deployed successfully with name XXX") and also the server.log for the portable JNDI name print out?
[Message sent by forum member 'hzhang_jn' (hong.zhang_at_sun.com)]

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