No, it is not possible. I have been working through the same issue, in the context of deploying an EJB 3.0 application on WebLogic 10.3.x.
The application runs on Oracle Application Server 10.1.3 and GlassFish 3.x.
- Oracle AS (OC4J) has a proprietary mechanism for looking up the local interface of an EJB using JNDI.
- GlassFish 3.x implements EJB 3.1 with its portable JNDI name syntax.
Our application uses a lookup mechanism for the current application server, which is determined at runtime.
In WebLogic Server 10.3, the local interface of an EJB:
- can be injected into managed classes in the servlet container (servlets, filters etc.) and other EJBs using
@EJB
annotations
- is only available for lookup from JNDI when it has been declared in a
ejb-local-ref
element in web.xml
or ejb-jar.xml
It is not practical for us to declare all EJBs that are looked up. We have 192 stateless EJBs, mostly injected but many looked up from JNDI because we need them available to unmanaged classes.
My source for this information, apart from trial and error, is WebLogic 10.3 EJB3 Local Lookup Sample. Almost everything else I found, including the Oracle documentation, describes the JNDI lookup syntax with mappedName#fullInterface
but does not make it clear that only the remote interface name is in the JNDI tree.
Update: We went with declarations in web.xml
and ejb-jar.xml
(yes, there are EJBs that use utility classes that look up other EJBs in JNDI). Started with a script to generate them from sources then manually edited them until they were correct. Not nice but necessary.