All Examples
package examples.rmi.stock
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:
- StockNotify is the remote interface for StockWatch.
- StockWatch is the remote interface for StockServer.
- Stock is the serializable object containing stock data.
- StockApplet (implements StockNotify) registers
with StockServer for stock updates displays stock notifications as
they are received.
- StockServer (implements StockWatch) sends
notifications of stock updates to remote objects that have registered
to receive updates.
how to use this package
- Set up your development environment as described in
Setting your development environment.
- The build scripts are:
- build.cmd - JavaSoft JDK running on NT
- buildms.cmd - Microsoft SDK for Java
- build.sh - UNIX
Run the appropriate build script as shown in this
example for the JavaSoft JDK running on NT:
$ build
- Copy the StockApplet.HTML file to your registered WebLogic document
root, weblogic/myserver/public_html, by default.
- 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.
- 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
- Start WebLogic Server in your development shell.
- 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.