[英]How to define own JNDI name for EJB in an ear
I have an ear
which has ejb.jar
, core.jar
. 我的ear
有ejb.jar
和core.jar
。
core.jar
use lookup
to find the bean at run time. core.jar
使用lookup
在运行时lookup
bean。 Now the jndi
path is mysystem-server-component-ear-0.0.1-SNAPSHOT/MyServiceBean/local
which means <earname>/<beanname>/<localinterface>
现在, jndi
路径是mysystem-server-component-ear-0.0.1-SNAPSHOT/MyServiceBean/local
,这表示<earname>/<beanname>/<localinterface>
I want to define JNDI
like MyServiceBean/local
. 我想像MyServiceBean/local
这样定义JNDI
。 Where my MyServiceBean is the ejb bean and it use local interface. 我的MyServiceBean是ejb bean,它使用本地接口。
I use EJB 3.1
without ejb-jar.xml
and jboss.xml
. 我使用没有ejb-jar.xml
和jboss.xml
EJB 3.1
。 All the wiring done through annotation
. 所有的接线都通过annotation
完成。
How can I define my own JNDI
name which I can lookup 如何定义自己的JNDI
名称以进行查询
Did you try @EJB(mappedName = "yourJndiName")
? 您是否尝试过@EJB(mappedName = "yourJndiName")
?
If your JNDI lookups are not working as expected, then you should always check your JNDI tree from within the administration frontend (should be somewhere in jmx-console/JBoss/service=JNDIView or similar). 如果您的JNDI查找未按预期工作,则应始终从管理前端中检查JNDI树(应位于jmx-console / JBoss / service = JNDIView或类似位置)。 Sometimes the name of the remote interface, etc. is added to your JNDI name by your application server. 有时,您的应用程序服务器会将远程接口的名称等添加到您的JNDI名称中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.