-
Bug
-
Resolution: Done
-
Major
-
2.0.2.Final
-
None
org.jboss.cdi.tck.tests.event.observer.context.enterprise.staticMethod.SessionBeanStaticObserverMethodInvocationContextTest is failing in GlassFish because of the lookup of the ejbs in java:comp in FooObserver. Here's the code in FooObserver#init around line 58:
toner = (Toner) InitialContext.doLookup("java:comp/Toner");
printer = (Printer) InitialContext.doLookup("java:comp/Printer");
I have debugged it and the reason is that GlassFish is not populating the java:comp namespace with the ejbs. GlassFish does populate the java:module namespace so this does work:
toner = (Toner) InitialContext.doLookup("java:module/Toner");
printer = (Printer) InitialContext.doLookup("java:module/Printer");
We (at Oracle) have been having a lengthy discussion about this and have found discrepancies between the EJB spec and the platform spec. In a very simplistic summary when the ejb is in a war the EJB spec (4.4.2.1) does not identify the java:comp as a namespace that must be populated (for the ejb) while the platform spec (5.2.2) says that java:comp refers to the same namespace as java:module implying that the ejb must be able to be looked up via both the java:module and java:comp namespace.
The following spec issue has been filed to evaluate of Java EE spec 5.2.2 paragraph "For historical reason ..." in relation to EJB spec portable JNDI lookup to clarify the requirement in the ejb spec: