Publishing EJB's local interface in weblogic

笑着哭i 提交于 2019-12-04 17:33:41

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.

A few more detail, check verification in Ejb3SessionBinder#bindToJNDI() skips the code binding with jndi and Home interface, this means: no local beans are callable from jndi tree because these wasn't registered. As has been said, 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.

(This information refer to wls 10.3.5).

It should still be in the java:comp/env namespace.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!