home *** CD-ROM | disk | FTP | other *** search
- This directory contains an example that illustrates an applet that
- exports a remote object in order to receive stock updates from a stock
- server. The applet displays the stock data dynamically as
- notifications are received from the server. The interfaces/classes for
- this example are as follows:
-
- StockWatch remote interface for stock server
-
- StockNotify remote interface for stock observer
-
- Stock serializable object containing stock data
-
- StockServer (implements StockWatch)
- sends notifications of stock updates to remote
- objects that have registered to receive updates
-
- StockApplet (implements StockNotify)
- applet that exports a remote object (itself);
- registers with StockServer for stock updates;
- displays stock notifications as they are received.
-
-
- On Solaris you can execute the "run" script in this directory, which
- will print out what it is doing while it runs the example. It assumes
- that you have installed rmi and set your PATH, CLASSPATH and
- LD_LIBRARY_PATH according to the installation instructions. The stock
- server creates its own registry, so the "rmiregistry" does not need to be
- started. Here are the basic step that the "run" script executes:
-
-
- % setenv CLASSPATH ../..:$CLASSPATH
- % javac -d ../.. *.java
- % rmic -d ../.. examples.stock.StockServer examples.stock.StockApplet
- % java examples.stock.StockServer &
- % appletviewer index.html
-
- Note: you can set your CLASSPATH back to the old CLASSPATH (without
- ../.. in it) before running the appletviewer, so that classes get
- downloaded via the network rather than via CLASSPATH; each of the
- scripts actually does this.
-
-
- On Windows systems, you can execute "run.bat" in this directory, which
- will explain each step as it builds and runs the example. Upon
- completion, you will need to explicitly destroy the window created for
- the server process.
-
-
- NOTE: When you run the applet you may see something similar to this:
-
- > StockApplet.init: exporting remote object
- > *** Security Exception: socket.listen:0 ***
- > sun.applet.AppletSecurityException: security.socket.listen: 0
- > at sun.applet.AppletSecurity.checkListen(AppletSecurity.java:337)
- > at java.net.ServerSocket.<init>(ServerSocket.java:75)
- > at java.net.ServerSocket.<init>(ServerSocket.java:58)
- > at sun.rmi.transport.proxy.RMIServerSocket.<init>(RMIServerSocket.java:47)
- > at sun.rmi.transport.proxy.HttpAwareServerSocket.<init>(HttpAwareServerSocket.java:47)
- > at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:266)
- > at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:256)
- > at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:182)
- > at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:219)
- > at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:114)
- > at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:94)
- > at java.rmi.server.UnicastRemoteObject.init(UnicastRemoteObject.java:105)
- > at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:67)
- > at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:120)
- > at examples.stock.StockApplet.init(StockApplet.java:80)
- > at sun.applet.AppletPanel.run(AppletPanel.java:259)
- > at java.lang.Thread.run(Thread.java)
- >
- > *** RMI unable to listen on socket: using multiplexed connections instead ***
-
- Don't Panic -- We handle this exception (which is what that last line
- says). All security exceptions are printed out, whether they are
- handled or not, but this one is handled internally by RMI.
-