All Examples 

package examples.rmi.stock

Interface Index

Class Index

Exception Index

about this package

The examples.rmi.examples.stock package illustrates how you might write a distributed application that uses an applet that exports a remote object to receive stock updates from a stock server. In this example, the applet displays the stock data dynamically as notifications are received from the server. This package was adapted with very few changes from the original example Stock package included with the JavaSoft RMI distribution.

Also included in this directory are build scripts for Windows NT, Microsoft SDK for Java, and UNIX. The scripts compile the files in this directory and run the RMI compiler on the implementation class.

There are detailed instructions on converting Sun RMI classes to use WebLogic RMI in the Developers Guide. The instructions here are brief and assume that you have or will look at the Developers Guide.

The classes and interfaces that you will compile and run for this example are as follows:

This applet will not work if you are running the server using JDK 1.2 or later since the web-browser is running an incompatible 1.1 JVM. If you wish to deploy applets from a server running with JDK 1.2, we suggest you use the Java Plug-in.

how to use this package

  1. Set up your development environment as described in Setting your development environment.

  2. If you are not going to be running the browser client and server on the same machine (using "localhost" to call up the StockApplet.html file), you will need to modify the "host" variable in StockServer.java to refer to the name of the machine running WebLogic Server.

  3. If you are not going to be using 7001 as the WebLogic listen port (weblogic.system.ListenPort), you will need to modify the "port" variable in StockServer.java to refer to the appropriate port number.

  4. The build scripts are: Run the appropriate build script as shown in this example for the JavaSoft JDK running on NT:
      $ build

  5. Copy the StockApplet.HTML file to your registered WebLogic document root, weblogic/myserver/public_html, by default.

  6. In the copy of the HTML file that calls the applet, adjust the serverPort parameter to the port where your WebLogic Server is listening, and the CODEBASE if necessary. The HTML file is shipped with the CODEBASE set to "classes/". If you are having problems, see Troubleshooting CODEBASE.

  7. Register the StockServer class as an RMI startup class in the weblogic.properties file with this entry:
      weblogic.system.startupClass.stock=examples.rmi.stock.StockServer
  8. Start WebLogic Server in your development shell.
  9. Call the applet from a browser. Make sure your browser doesn't have the WebLogic classes in its CLASSPATH, if you're using a browser on the same machine that is hosting your WebLogic Server. Use a URL like:
      http://WebLogicURL:Port/StockApplet.html

    WebLogicURL
    Domain address of the WebLogic Server
    Port
    Port that is listening for connections (weblogic.system.ListenPort)

there's more . . .

Read more about this WebLogic service in the Developers Guide, Using WebLogic RMI.