简体   繁体   English

如何在 WebSphere Liberty 中更改 EJB JNDI 绑定

[英]How to change EJB JNDI bindings in WebSphere Liberty

I have an ear application which is deployed to WebSphere Liberty 8.5.我有一个部署到 WebSphere Liberty 8.5 的ear应用程序。 The application includes an EJB module in which I declared a few EJBs.该应用程序包含一个 EJB 模块,我在其中声明了几个 EJB。 My EJBs are declared in the following way:我的 EJB 以下列方式声明:

public interface MyEjb...

@Local
public interface MyEjbLocal extends MyEjb...

@Remote
public interface MyEjbRemote extends MyEjb...

@Stateless
public class MyEjbBean implements MyEjbLocal, MyEjbRemote...

When application starts I can see in WebSphere Liberty log that this EJB gets the following JNDI names:当应用程序启动时,我可以在 WebSphere Liberty 日志中看到此 EJB 获得以下 JNDI 名称:

java:global/my-ear-app-name/my-ejb-module-name/MyEjbBean!my.package.name.MyEjbLocal,
java:global/my-ear-app-name/my-ejb-module-name/MyEjbBean!my.package.name.MyEjbRemote

I need to change these names.我需要更改这些名称。 If I understand it correctly, it can be done in the ibm-ejb-jar-bnd.xml file.如果我理解正确,它可以在ibm-ejb-jar-bnd.xml文件中完成。 I have an ibm-ejb-jar-bnd.xml file in the META-INF directory of my EJB module jar file.我的 EJB 模块jar文件的META-INF目录中有一个ibm-ejb-jar-bnd.xml文件。 This file contains the following configuration:该文件包含以下配置:

<session name="MyEjbBean" simple-binding-name="my/new/jndi/name"></session>

However, this configuration does not have any effect: when I start the ear application I still see the default JNDI bindings in the log.但是,此配置没有任何效果:当我启动 ear 应用程序时,我仍会在日志中看到默认的 JNDI 绑定。

I know that ibm-ejb-jar-bnd.xml is picked up correctly by WebSphere Liberty, because when I specify a wrong bean name in the <session> tag, I get a warning in WebSphere log.我知道ibm-ejb-jar-bnd.xml被 WebSphere Liberty 正确选取,因为当我在<session>标记中指定错误的 bean 名称时,我会在 WebSphere 日志中收到警告。

How can I change EJB JNDI bindings in WebSphere Liberty?如何在 WebSphere Liberty 中更改 EJB JNDI 绑定?

My understanding is that the simple-binding-name is ignored in ibm-ejb-jar-bnd.xml files for WebSphere Liberty.我的理解是,在 WebSphere Liberty 的 ibm-ejb-jar-bnd.xml 文件中忽略了 simple-binding-name。

It is mentioned in below doc (search for "simple-binding"): http://www.ibm.com/support/knowledgecenter/SSAW57_liberty/com.ibm.websphere.wlp.nd.doc/ae/rwlp_restrict.html它在下面的文档中提到(搜索“简单绑定”): http : //www.ibm.com/support/knowledgecenter/SSAW57_liberty/com.ibm.websphere.wlp.nd.doc/ae/rwlp_restrict.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM