【发布时间】:2016-09-29 11:15:24
【问题描述】:
请看下面的代码:
Context ctx = null;
ctx=new InitialContext();
TestEJBRemote t = (TestEJBRemote) ctx.lookup("java:global/EJBTest/EJBTest-ejb/TestEJB");
System.out.println(t.getName("Ian"));
输出是我所期望的,即 Hello Ian。
以上代码假定客户端与 Glassfish 实例安装在同一台计算机上。如何从远程应用程序客户端获得相同的结果。我试过这个:
Context ic = new InitialContext();
TestEJBRemote t = (TestEJBRemote) ic.lookup("corbaname:computer:4848#/a/b/TestEJB");
System.out.println(t.getName("Ian"));
会产生错误。我假设该端口是安装 Glassfish 的端口。
【问题讨论】:
标签: java jakarta-ee jndi glassfish-4