My files are in expert:/user/faculty/amk/www/foo/cscijava/network> ls Account.class HelloImpl.java~ index.html showthem Hello.html Receipt.class index.html~ tcpClient.class Hello.html~ examples javalab3.html tcpClient.java Hello.java fileServer.class readFile.class tcpClient.java~ HelloApplet.java fileServer.java readFile.java tcpServer.class HelloImpl.java fileServer.java~ readFile.java~ tcpServer.java
Now, this is interesting that they have us use this, since in code for the client, we do
This makes sense then, why what happens below happens...
expert:/user/faculty/amk/www/foo/cscijava/network/examples/hello> ls Hello.class HelloApplet.class HelloImpl_Skel.class Hello.html HelloImpl.class HelloImpl_Stub.class Start the RMI registry expert:/user/faculty/amk/www/foo/cscijava/network> rmiregistry & [1] 29848 expert:/user/faculty/amk/www/foo/cscijava/network> jobs [1] + Running rmiregistry &Since the server is at expert.ecst.csuchico.edu, I will run the client elsewhere - say on Molly (my SUN at home)
system responds with
Happy with this so try to start applet on Molly:
appletviewer Hello.html
HelloApplet exception: Connection refused to host: [molly:1099]; nested exception is:
java.net.ConnectException: Connection refused
java.rmi.ConnectException: Connection refused to host: [molly:1099]; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPChannel.openSocket(TCPChannel.java:240)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:125)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:73)
at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:86)
at java.rmi.Naming.lookup(Naming.java:60)
at examples.hello.HelloApplet.init(HelloApplet.java:10)
at sun.applet.AppletPanel.run(AppletPanel.java:287)
at java.lang.Thread.run(Thread.java)
Now, if I run both the client and the server on the same machine, the above code works. The above code has in the client
So, I try the client and server on different machines...and it gives error above, unless change the client to
As far as I understand, the use of the system property (set with -D option on the command line or inside a program) java.rmi.server.codebase is used to identify the codebase for the RMIClassLoader. If there are no remote classes that will be loaded, this is not needed...?.
By default, the client would try to connect to a server on the local machine
If the client and the server are on the same computer (or cross-mounted?), the code base can be a file URL. However, if the client and server are on different computers, a Web server is necessary to provide a host for the class files, and the URL should target this Web server Without this bootstrapping technique, all the classes directly referenced in the client code must be available through the local CLASSPATH on the client, and the only Java classes that can be loaded by the RMIClassLoader over the net are classes that are not referred to directly in the client program; these classes are stubs, skeletons, and the extended classes of arguments and return values to remote method invocations.