【问题标题】:Lookup of remote interface is not getting recognised in JBossJBoss 无法识别远程接口的查找
【发布时间】:2024-01-21 08:14:02
【问题描述】:

IPMBaseBean.class 使用以下代码访问远程接口。

Object obj = iniCtx.lookup("java:/comp/env/ejb/ODIControllerSessionEJB");

jboss-web.xmljndi-name中引用如下

<ejb-ref-name>ejb/ODIControllerSessionEJB</ejb-ref-name>
<jndi-name>jnp://vwhq5275.whq.ual.com:6200/ODIControllerSessionEJB</jndi-name>

错误:

Naming exception 
javax.naming.NameNotFoundException: comp not bound..

请就这个问题提出建议。

【问题讨论】:

  • 您是否尝试访问远程计算机上的 EJB?

标签: java jboss ejb jndi


【解决方案1】:

在启动 JBoss 时,它会显示如下所示的 Global JNDI 名称:

 15:26:47,394 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

        hrms/AccountSummarySessionBean/local - EJB3.x Default Local Business Interface
        hrms/AccountSummarySessionBean/local-com.cc.hrms.bl.accounts.generalaccount.session.AccountSummarySessionBeanLocal - EJB3.x Local Business Interface

然后您可以使用该约定进行查找

查找签名 - “hrms/AccountSummarySessionBean/local-com.cc.hrms.bl.accounts.generalaccount.session.AccountSummarySessionBeanLocal”

initialContext.lookup(ProjectConstants.PROJECT_NAME+className.getSimpleName().substring(0, className.getSimpleName().lastIndexOf("Local")) + "/local-" + className.getName());

我在 JBoss-5 中工作,这个约定对我来说很好。

【讨论】:

    最近更新 更多