B
bebonights
Hi folks,
I have developed several EJB-Examples with j2sdkee1.3 running the
J2EE-Server and the Client (Java-Application) on one Computer. Now I
would like to try it with two Workstations - one running the
J2EE-Server, the other running the client.
Both Workstations are properly connected, the Station I'd like to use
for the server has the IP 111.111.111.111, the Client-Station has
111.111.111.112.
My questions (Please detailed answers a beginner can understand...)
1) How should the following Client be changed to do what I want:
-------------------------------------------------------------
package hallo;
import javax.naming.*;
import javax.rmi.*;
public class HalloClient
{
public static void main(String[] args)
{
try
{
Context context = new InitialContext();
Object object = context.lookuk("java:comp/env/ejb/Hallo");
HalloHome home = (HalloHome)PortableRemoteObject.narrow(
object, HalloHome.class);
Hallo hallo = home.create();
System.out.println(hallo.sagHallo());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
-------------------------------------------------------------
I know that I should create a Hashtable-Object with several Properties
(INITIAL_CONTEXT_FACTROY, PROVIDER_URL) - but what values should I
use?
2) How should the Server-Machine be set up? Up to now, the only server
displayed in the deploytool is localhost.
3) How should the Client-Machine be prepared? Which files does the
client need? Only the jar-file containing the RMI-Stubs, which is
created when the application is deployed? The ear-file? The package
j2ee.jar? Or is it the easiest was to install j2sdkee1.3 on the
Client-Machine?
Thanks for your answers!
I have developed several EJB-Examples with j2sdkee1.3 running the
J2EE-Server and the Client (Java-Application) on one Computer. Now I
would like to try it with two Workstations - one running the
J2EE-Server, the other running the client.
Both Workstations are properly connected, the Station I'd like to use
for the server has the IP 111.111.111.111, the Client-Station has
111.111.111.112.
My questions (Please detailed answers a beginner can understand...)
1) How should the following Client be changed to do what I want:
-------------------------------------------------------------
package hallo;
import javax.naming.*;
import javax.rmi.*;
public class HalloClient
{
public static void main(String[] args)
{
try
{
Context context = new InitialContext();
Object object = context.lookuk("java:comp/env/ejb/Hallo");
HalloHome home = (HalloHome)PortableRemoteObject.narrow(
object, HalloHome.class);
Hallo hallo = home.create();
System.out.println(hallo.sagHallo());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
-------------------------------------------------------------
I know that I should create a Hashtable-Object with several Properties
(INITIAL_CONTEXT_FACTROY, PROVIDER_URL) - but what values should I
use?
2) How should the Server-Machine be set up? Up to now, the only server
displayed in the deploytool is localhost.
3) How should the Client-Machine be prepared? Which files does the
client need? Only the jar-file containing the RMI-Stubs, which is
created when the application is deployed? The ear-file? The package
j2ee.jar? Or is it the easiest was to install j2sdkee1.3 on the
Client-Machine?
Thanks for your answers!