Server Smalltalk includes several PingPong-based examples of clients and servers written in Java. These interact with Smalltalk via RMI or IIOP. They can be run with Java systems based on JDK 1.1.7b or later. If you are using a JDK version earlier than 1.2.2, then you need to set the RMI marshaling configuration to utilize Java 1 stubs. To do this, send the stubProtocolVersion: @constant message to the instance of SstRmiMarshallingConfiguration that is associated with your invocation handler. The value of @constant should be SstRmiStubVersion1. The acceptable values for @constant are located in the SstRmiConstants pool dictionary.The Java code is in the file sstjava.zip. When unzipping the file, ensure that the directory structure and long file names are preserved. Add the unzip destination directory to the Java classpath. Alternatively, it is often convenient to simply add '.' (a period) to the classpath and then change your working directory to the root Java code directory when running the examples. If you are running from within VisualAge for Java, the file must be unzipped and imported into your Workspace. Add the Project into which the code was loaded to the classpath for the Workspace (see the Workspace>>Options menu). Note that running in VisualAge for Java is only practical for the RMI-based examples as the third-party IIOP products may or may not be integrated with VisualAge for Java and so may not use Java code directly from the repository.
1. [pong] Ensure that in addition to the standard paths, your classpath includes the current directory (e.g., classpath=<standard directories>) or the absolute path to the directory containing your code.
2.
3. [pong] Run the RMI registry on Pong:
start rmiregistry
Note that this does not need to be shutdown and restarted each time. You must ensure that no one else is running an RMI registry or using port 1099 on your machine. Use netstat -an before running the setup code and see if port 1099 is allocated. If so, find the program using it and stop it. RMI defaults to port 1099.
4. [pong] Run the PingPongFactory on pong and tell it to create instances of the desired PingPong class.
java com.ibm.sst.examples.rmi.PingPongFactory
com.ibm.sst.examples.rmi.PingPong
5.
6. [ping] Create the ping and pong objects and start the example:
(SstPingPongRmi createPingAndPong: 'rmi://pong.com') start: 6 with 'test'
Where pong.com is the IP address or host name of the machine running Pong. Change the arguments to #start:with: to suit your needs.
9.
1. [pong] Setup the SST infrastructure, an RMI naming service and the PingPongFactory. For example:
SstPingPongRmi setupPong
Note that this does not need to be shutdown and restarted each time. You must ensure that nothing else is running an RMI registry or using port 1099 on your machine. Use netstat -an before running the setup code and see if port 1099 is allocated. If so, find the program using it and stop it. RMI defaults to port 1099.
2. [ping] Ensure that in addition to the standard paths, your classpath includes the current directory (e.g., classpath=<standard directories>) or the absolute path to the directory containing your code (e.g. your <vast> installation directory).
3.
4. [ping] Start the example by running the appropriate Java class:
java com.ibm.sst.examples.rmi.PingPong
rmi://pong.com/pingPongFactory 6 test
Where pong.com is the IP address or host name of the machine running Pong. Change the arguments to suit your needs.
7. The other RMI Ping Pong examples (e.g., PingPongExceptional) are run by substituting the corresponding example class names wherever an example class name is provided. That is, in steps 4, 5 and 6 of the Smalltalk Ping, Java Pong configuration and steps 1 and 4 of the Java Ping, Smalltalk Pong configuration.To run the applet version of the client, start the registry and factory as above (or in Smalltalk) and open the file ppapplet.htm in an AppletViewer. Note that the HTML file assumes the root of the PingPong code hierachy is in the same directory as the HTML file itself.To enable RMI callback, the applet class must import the package netscape.security.* and include the following line in its init() method before any RMI call has been made.where <temporary directory> is the place where all your applet code resides. This will create a signed jar archive which can be downloaded by the client browser. You will need to add the following parameter ARCHIVE=<jarfile name> in the ppapplet.htm file following the CODE parameter. This is to ensure the client will get the required classes to run the applet.On the browsers which will download and run the signed applet, they need to click on the certificate link. This will bring up a prompt which they will need to follow to import it into their certificate database. Be sure to select Accept this Certificate Authority for Certifying software developers when that question pops up.
![]() |