Please see the code below:
Context ctx = null;
ctx=new InitialContext();
TestEJBRemote t = (TestEJBRemote) ctx.lookup("java:global/EJBTest/EJBTest-ejb/TestEJB");
System.out.println(t.getName("Ian"));
The output is what I expect i.e. Hello Ian.
The code above assumes that the client is installed on the same computer as the Glassfish instance. How do I get the same result from a remote application client. I have tried this:
Context ic = new InitialContext();
TestEJBRemote t = (TestEJBRemote) ic.lookup("corbaname:computer:4848#/a/b/TestEJB");
System.out.println(t.getName("Ian"));
which produces an error. I assume that the port is the port that Glassfish is installed on.
See Question&Answers more detail:os