【问题标题】:Remote EJB binding is not shown in the log - Websphere Liberty日志中未显示远程 EJB 绑定 - Websphere Liberty
【发布时间】:2019-03-21 06:45:15
【问题描述】:

我正在尝试按照红皮书示例(IBM WebSphere Application Server Liberty Profile Guide for Developers,5.2.3 Developing applications using remote EJB)在 Liberty Profile 服务器中调用远程 EJB。

所有编译和部署都没有问题,但在运行时给出以下错误消息:

Error 404: javax.servlet.UnavailableException: SRVE0319E: For the [com.ibm.itso.ejbRemote.HelloRemoteServlet] servlet, com.ibm.itso.ejbRemote.HelloRemoteServlet servlet class was found, but a resource injection failure has occurred. CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/com.ibm.itso.ejbRemote.HelloRemoteServlet/helloRemoteBean reference. The exception message was: CWNEN1003E: The server was unable to find the java:global/ITSORemote/ITSORemoteEJB/HelloRemoteEJB!com.ibm.itso.ejbRemote.view.HelloRemoteEJBRemote binding with the com.ibm.itso.ejbRemote.view.HelloRemoteEJBRemote type for the java:comp/env/com.ibm.itso.ejbRemote.HelloRemoteServlet/helloRemoteBean reference.

有什么问题吗?本地 EJB 示例运行良好。

仅在客户端代码中指定远程 EJB 是否足够,或者也可以在其他位置(属性文件或 server.xml)?

@EJB(lookup="java:global/ITSORemote/ITSORemoteEJB/HelloRemoteEJB!com.ibm.itso.ejbRemote.view.HelloRemoteEJBRemote") 
 private HelloRemoteEJBRemote helloRemoteBean;

只有带有@Local注解的接口是绑定的,并且会显示在日志中。带有@Remote 注释的接口未绑定,也未显示在日志中。

可能是什么错误?

【问题讨论】:

  • 您可以访问 websphere 管理控制台吗?如果是这样,您能否在管理控制台中的 Applications > Application Types > WebSphere Enterprise Applications > application_name > EJB references 中检查 EJB 绑定是否正确
  • 在 Websphere Liberty 中没有这样的选项

标签: websphere websphere-liberty ejb-3.2


【解决方案1】:

这个procedure确实有一些额外的配置,最后它被指定从你的应用程序配置ibm-*-bnd.xml:

<ejb-ref name="helloRemoteBean" binding-name="java:global/ITSORemote/ITSORemoteEJB/HelloRemoteEJB!com.ibm.itso.ejbRemote.view.HelloRemoteEJBRemote"/>

【讨论】:

    【解决方案2】:

    如果@Remote 接口未绑定,则 server.xml 要么不包含 ejbRemote-3.2 功能,要么缺少 ORB 配置(即,如果 ORB 未启动,则 ejbRemote 功能将不会启动正确。例如,您的 server.xml 是否至少包含以下内容:

    <server>
        <featureManager>
            <feature>ejbRemote-3.2</feature>
        </featureManager>
    
        <iiopEndpoint id="defaultIiopEndpoint" iiopPort="2809" iiopsPort="2810"/>
    </server>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多