I have two laptops. Both are connected to the Internet via my home wi-fi router.
: testing Java Enterprise Edition 7 applications, using NetBeans 8 and GlassFish 4
: testing Java Standard Edition 7 applications, using Eclipse Mars
Here is what I did on laptop1:
- Packaged a simple EJB component and a library containing the EJB's remote interface into an EAR.
- Deployed it successfully on GlassFish.
- Packaged an enterprise application client and the same library containing the EJB's remote interface into a module and deployed it separately on GlassFish.
- Both applications (EAR and client module) were running fine and the client was able to invoke the ejb component's method using dependency injection (@EJB).
Here is what I am facing problems with while doing something involving both laptop1 and laptop2:
I am trying to create a stand-alone non-EE client on laptop2 in order to invoke methods on the remote EJB component residing on laptop1. I am following this document https://glassfish.java.net/docs/4.0/application-development-guide.pdf
The steps written in that document are below. Please see my questions embedded below.
InitialContext ctx = new InitialContext();
BeanRemote bean = (BeanRemote) ctx.lookup("com.acme.BeanRemote");
It does not look like JNDI to me. Where is java:global in it? Is this really portable or GlassFish specific?
Copy the as-install/lib/gf-client.jar file to the client machine and include it in the classpath on the client side. How do I do it and where do I find the classpath on the client side?
If there is no GlassFish Server installation on the client machine (duh!)
, you must also copy the as-install/modules directory to the client machine and maintain its directory structure relative to the as-install/lib/gf-client.jar file. Relative in the classpath?
Set the following system properties for the JVM startup options:
Here ORBhost is the GlassFish Server hostname and ORBport is the ORB port number (default is 3700 for the default server instance, named server).
How do I set the above startup options for the JVM on the client side?
Make sure the etc/hosts file on the client machine maps the GlassFish Server hostname and external IP address. In this file on each laptop do I need to tag a fully qualified domain to the computer name and place it next to the IP assigned by the wi-fi network?