Page 1 of 1

About Question enthuware.oce-ejbd.v6.2.446 :

Posted: Mon Aug 08, 2011 6:32 pm
by PedroKowalski
Howdy!

I've got a question. At the beginning you're talking about:
@Stateless
public class XBean implements XLocal{...}
and then you say that you can look the local interface by doing:
XLocal ref = (mybeans.XLocal) ic.lookup("java:global/mybeans/XLocal");
Well, I'm curious. In the fully-fledged EJB container you should do:
XLocal ref = (mybeans.XLocal) ic.lookup("java:global/mybeans/XBean!mybeans.XLocal");
Is the embedded container somehow using different JNDI namespaces? How should the appropriate answer look then?

Thanks in advance!

Cheers!

Re: About Question enthuware.oce-ejbd.v6.2.446 :

Posted: Wed Aug 10, 2011 5:28 am
by admin
You are right. The name should have XBean!
This has been updated.

thanks for your feedback!

Re: About Question enthuware.oce-ejbd.v6.2.446 :

Posted: Wed Oct 19, 2011 10:25 am
by Guest
I think there are several problems with this question:

1) It is not clear how the bean is deployed in the container. This can be done by putting the bean in the jvm classpath, either within a ejb-jar, or simply as a classfile in a directory. I guess the question assumes the classfile is deployed in a directory.

2) In the "java:global/" JNDI syntax, the module name is not optional. So what is the module name in case of the bean's deployment in a directory? It is the directory name. So one should be able to look up the bean with "java:global/mybeans/XBean".

3) If also the fully qualified interface name is specified in the lookup String, of course dots are used in the within the fully qualified name. Hence the lookup String should be: "java:global/mybeans/XBean!mybeans.XLocal"

Re: About Question enthuware.oce-ejbd.v6.2.446 :

Posted: Sun Oct 23, 2011 8:33 am
by admin
From Section 4.4 of EJB 3.1 specification:-
  • <app-name> only applies if the session bean is packaged within an .ear file.
  • 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.
  • <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
Based on above, if the the name of the module is myModule, the correct name should be: "java:global/myModule/XBean!mybeans.XLocal"

I have updated the question accordingly.

HTH,
Paul.

Re: About Question enthuware.oce-ejbd.v6.2.446 :

Posted: Wed Oct 26, 2011 10:06 am
by Guest
I agree as far as deployment within an ejb-jar is concerned. However, in the embedded container there also seems to exist the option of deploying the ejb as class file only. From section 22.2.1 of EJB 3.1 spec:

"By default, the embeddable container searches the JVM classpath(the value of the Java System property
java.class.path) to find the set of EJB modules for initialization. A classpath entry is considered
a matching entry if it meets one of the following criteria:
• It is an ejb-jar according to the standard module-type identification rules defined by the Java
EE platform specification
• It is a directory containing a META-INF/ejb-jar.xml file or at least one .class with an enterprise
bean component-defining annotation
Each matching entry is considered an EJB module within the same application.
[105]

If an ejb-jar.xml is present the module-name element defines the module name. Otherwise, for ejb-jars
the module name is the unqualified file name excluding the “.jar” extension and for directories the mod-
ule name is the unqualified name of the directory (the last name in the pathname’s name sequence)."

Best regards,
Roland

Re: About Question enthuware.oce-ejbd.v6.2.446 :

Posted: Sun Feb 18, 2018 10:25 am
by mcqueide
I couldn't understand why answer number 1 is not correct, an embedded EJB server can't do resource lookup by InitalContext?