WebSphere 7. Inject EJB from another application

岁酱吖の 提交于 2019-11-29 23:21:36

Specify the binding when deploying the application (1, 2), or include a META-INF/ibm-ejb-jar-bnd.xml in your client (myapp1) EJB module. It would look something like this:

<ejb-jar-bnd
    xmlns="http://websphere.ibm.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_0.xsd"
    version "1.0">
  <session name="HelloEjbImpl1">
    <ejb-ref name="com.mycompany.myapp.ejb.test1/helloEjb2"
        binding-name="myapp2/myapp2.jar/HelloEjbImpl2#com.mycompany.myapp1.ejb.test1.HelloEjb1"
  </session>  
</ejb-jar-bnd>

The ejb-ref name="..." can be simplified if you use @EJB(name="myrefname"). The binding-name can be simplified if your myapp2.jar includes a similar binding file with an <interface class="..." binding-name="..."/> element.

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