users@glassfish.java.net

Re: Glassfish 3 local ejb lookup problem.

From: Major Péter <majorpetya_at_sch.bme.hu>
Date: Sun, 07 Feb 2010 22:47:24 +0100

Sorry, I just knew that the JNDI naming has been changed, but couldn't
found any more detailed source with few minutes google, but now (almost)
here it is:
http://jcp.org/en/jsr/detail?id=318
in the spec on the page 83 there is the following section:

> Each portable session bean global JNDI name has the following syntax :
> java:global[/<app-name>]/<module-name>/<bean-name>[!<fully-quali-
> fied-interface-name>]
> <app-name> only applies if the session bean is packaged within an .ear file. It defaults to the base
> name of the .ear file with no filename extension, unless specified by the application.xml deploy-
> ment descriptor.
> <module-name> is the name of the module in which the session bean is packaged. In a stand-alone
> ejb-jar file or .war file, the <module-name> defaults to the base name of the module with any
> filename extension removed. In an ear file, the <module-name> defaults to the pathname of the
> module with any filename extension removed, but with any directory names included. The default
> <module-name> can be overriden using the module-name element of ejb-jar.xml (for ejb-jar
> files) or web.xml (for .war files).
> <bean-name> is the ejb-name of the enterprise bean. For enterprise beans defined via annotation, it
> defaults to the unqualified name of the session bean class, unless specified in the contents of the
> Stateless/Stateful/Singleton annotation name() attribute. For enterprise beans defined via
> ejb-jar.xml, it’s specified in the <ejb-name> deployment descriptor element.
> The container registers a separate JNDI name entry for each local business interface, each remote busi-
> ness interface, and any no-interface view, 2.x local home interface, and 2.x remote home interface. For
> the no-interface view, the last portion of the entry name is the fully-qualified bean class name.

If I understand correctly, in the list, there is the FQN format, and in
my server.log I can also see that:
Portable JNDI names for EJB TestBean :
[java:global/TestApp/TestApp-ejb/TestBean,
java:global/TestApp/TestApp-ejb/TestBean!hu.demo.TestBeanLocal]|#]
but I also failed to lookup with the interface fqn.

After this, I made some search in the spec, but couldn't find any info
about, whether it's possible to lookup with fqn or not. So, I let
smarter people to help you. :)

Regards,
Peter

2010-02-07 21:45 keltezéssel, glassfish_at_javadesktop.org írta:
> Thanks I had already read that, but could not connect it to my own code.
>
> It says:
>
> java:global[/<app-name>]/<module-name>/<bean-name>
>
> How do I find out what app-name, module-name and bean-name is? I do not have these set anywhere. The name of the ear and the name of the ejb jar?
>
> Does having to specify these mean I need to specify a bunch of metadata somewhere in my application? Is this not going back a step?
>
> Looking up my local interface by its FQ name could not have been any simpler and the code does not need to know anything more complicated.
>
> This is not making sense. Sorry.