home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / RMI_OS / RMI-PREB / EXAMPLES / STOCK / README.TXT < prev    next >
Encoding:
Text File  |  1996-11-08  |  3.6 KB  |  77 lines

  1. This directory contains an example that illustrates an applet that
  2. exports a remote object in order to receive stock updates from a stock
  3. server.  The applet displays the stock data dynamically as
  4. notifications are received from the server. The interfaces/classes for
  5. this example are as follows:
  6.  
  7.     StockWatch        remote interface for stock server
  8.     
  9.     StockNotify        remote interface for stock observer
  10.     
  11.     Stock        serializable object containing stock data
  12.     
  13.     StockServer        (implements StockWatch)
  14.             sends notifications of stock updates to remote
  15.             objects that have registered to receive updates
  16.             
  17.     StockApplet        (implements StockNotify)
  18.             applet that exports a remote object (itself);
  19.             registers with StockServer for stock updates;
  20.             displays stock notifications as they are received.
  21.  
  22.  
  23. On Solaris you can execute the "run" script in this directory, which
  24. will print out what it is doing while it runs the example.  It assumes
  25. that you have installed rmi and set your PATH, CLASSPATH and
  26. LD_LIBRARY_PATH according to the installation instructions.  The stock
  27. server creates its own registry, so the "rmiregistry" does not need to be
  28. started.  Here are the basic step that the "run" script executes:
  29.  
  30.  
  31. % setenv CLASSPATH ../..:$CLASSPATH
  32. % javac -d ../.. *.java
  33. % rmic -d ../.. examples.stock.StockServer examples.stock.StockApplet
  34. % java examples.stock.StockServer &
  35. % appletviewer index.html
  36.  
  37. Note: you can set your CLASSPATH back to the old CLASSPATH (without
  38. ../.. in it) before running the appletviewer, so that classes get
  39. downloaded via the network rather than via CLASSPATH; each of the
  40. scripts actually does this.
  41.  
  42.  
  43. On Windows systems, you can execute "run.bat" in this directory, which
  44. will explain each step as it builds and runs the example.  Upon
  45. completion, you will need to explicitly destroy the window created for
  46. the server process.
  47.  
  48.  
  49. NOTE: When you run the applet you may see something similar to this:
  50.  
  51. > StockApplet.init: exporting remote object
  52. > *** Security Exception: socket.listen:0 ***
  53. > sun.applet.AppletSecurityException: security.socket.listen: 0
  54. >     at sun.applet.AppletSecurity.checkListen(AppletSecurity.java:337)
  55. >     at java.net.ServerSocket.<init>(ServerSocket.java:75)
  56. >     at java.net.ServerSocket.<init>(ServerSocket.java:58)
  57. >     at sun.rmi.transport.proxy.RMIServerSocket.<init>(RMIServerSocket.java:47)
  58. >     at sun.rmi.transport.proxy.HttpAwareServerSocket.<init>(HttpAwareServerSocket.java:47)
  59. >     at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:266)
  60. >     at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:256)
  61. >     at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:182)
  62. >     at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:219)
  63. >     at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:114)
  64. >     at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:94)
  65. >     at java.rmi.server.UnicastRemoteObject.init(UnicastRemoteObject.java:105)
  66. >     at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:67)
  67. >     at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:120)
  68. >     at examples.stock.StockApplet.init(StockApplet.java:80)
  69. >     at sun.applet.AppletPanel.run(AppletPanel.java:259)
  70. >     at java.lang.Thread.run(Thread.java)
  71. >  
  72. > *** RMI unable to listen on socket: using multiplexed connections instead ***
  73.  
  74. Don't Panic -- We handle this exception (which is what that last line
  75. says).  All security exceptions are printed out, whether they are
  76. handled or not, but this one is handled internally by RMI.
  77.