Websphere 8.5.5-EJB查找-javax.naming.NameNotFoundException

问题描述

我正在尝试从我本地环境中位于不同WebSphere 8.5.5 Server实例上的WebApp调用EJB。

  • EJB模块部署在第一台WebSphere 8.5.5服务器上-URL:iiop:// localhost:2818

  • WebApp部署在第二个WebSphere 8.5.5服务器上-可从http:// localhost:9084 /

    访问

  • 接口:com.package.client.MyAppServiceRemote
  • bean企业:MyAppService
  • 模块:my-app-ejb.jar
  • app:my-app-ear

在EJB模块部署期间,我可以在控制台日志中看到一条消息,指出该绑定是在以下位置创建的:

  • ejb / my-app-ear / my-app-ejb.jar / MyAppService#com.package.client.MyAppServiceRemote
  • com.package.client.MyAppServiceRemote
  • java:global / my-app-ear / my-app-ejb / MyAppService!com.package.client.MyAppServiceRemote

在我的webApp中,我以这种方式进行EJB查找:

    Properties props = new Properties();
    InitialContext ctx;
    String serverUrl = "iiop://localhost:2818";
    String jndi = "com.package.client.MyAppServiceRemote";

    props.put(Context.INITIAL_CONTEXT_FACTORY,GestoreProperties.getUniqueInstance().getinitialContextFactory());
    props.put(Context.PROVIDER_URL,serverUrl);
    ctx = new InitialContext(props);

    MyAppServiceRemote myAppServiceRemote = (MyAppServiceRemote) ctx.lookup(jndi);

我遇到此错误

javax.naming.NameNotFoundException:上下文:USERNode05Cell / nodes / USERNode05 / servers / server1,名称:com.package.client.MyAppServiceRemote:找不到名称com.package.client.MyAppServiceRemote中的第一个组件。 [根本例外是org.omg.CosNaming.NamingContextPackage.NotFound:IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]


我试图将所有三个名称都设置为jndi

  • ejb / my-app-ear / my-app-ejb.jar / MyAppService#com.package.client.MyAppServiceRemote
  • com.package.client.MyAppServiceRemote
  • java:global / my-app-ear / my-app-ejb / MyAppService!com.package.client.MyAppServiceRemote 但没有人起作用。

如何优化EJB的确切jndi名称? 很多thaks

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)