Weblogic 10.3.5 & EJB 3 JNDI names

*爱你&永不变心* 提交于 2019-12-06 12:30:58

Unfortunately, EJB 3.0 does not specify a standard JNDI naming and leave it up to the server vendor. You are right by quoting WL documentation about mappedName: "If you specify this attribute, the stateless session bean may not be portable". The drawback of mappedName attribute is that the global JNDI name will be default to mappedName#FullyQualifiedRemoteInterface. Since mappedName is an annotation within the source code, it makes your code non-portable. The preferred way is to keep vendor-specific behavior in vendor specific deployment descriptors, such as weblogic-ejb-jar.xml. This way, you also have the choice of specifying your own custom JNDI name without the predetermined format as mappedName#FullyQualifiedRemoteInterface.

EJB 3.1 made some efforts to standardize JNDI names at global,application, and module levels. Please see http://docs.oracle.com/cd/E19798-01/821-1841/girgn/index.html

You can try context.lookup("ServiveImpl#com.Service");, where ServiveImpl is the mapped name for bean & after # it should be fully qualified interface name.

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