Trouble Shooting and RMI

I am just making this page as I remember things that are common mistakes when people try to do RMI.
  1. The RMI SUN tutorial.
  2. Packages.
  3. Start the RMI registry
  4. RMIClassloader. Even though you may not be interested in exactly what we have going on here, this file may help you with problems at your site too...especially the stuff at the end of the page
  5. Java 1.2 security changes:
    Java has adopted new security protocols with the introduction of Java 1.2. When you set up a RMI system you must provide a security manager. Java 1.2 requires a policy file be included with your class files. Java 1.1 did not require the policy file. The policy file is used to set access privileges. You need to be aware of these security changes if you plan to compile your code with Java 1.2.

    ERRORS

    Tried to put web page for the 1.2 HelloWorld example on Expert web
    page http://ai-web.ecst.csuchico.edu/modules/rmi/hello.html
    with RMI server at
    pip:/user/faculty/amk/courses/advjava/rmi/myclasses
    
    java  -Djava.rmi.server.codebase=http://ai-web.ecst.csuchico.edu/modules/advjava/rmi/mysrc -Djava.security.policy=pip.ecst.csuchico.edu:/user/faculty/amk/courses/advjava/rmi/myclasses/policy examples.hello.HelloImpl
    
    java.security.AccessControlException: access denied (java.net.SocketPermission pip.ecst.csuchico.edu resolve)
    
    when I used
    
    java  -Djava.rmi.server.codebase=http://ai-web.ecst.csuchico.edu/modules/advjava/rmi/mysrc -Djava.security.policy=/user/faculty/amk/courses/advjava/rmi/myclasses/policy examples.hello.HelloImpl
    
     got
    
    HelloServer bound in registry
    
    but when run applet get
    
    HelloApplet exception: security.Couldn't connect to 'pip.ecst.csuchico.edu' with origin from 'ai-web.ecst.csuchico.edu'.
    netscape.security.AppletSecurityException: security.Couldn't connect to 'pip.ecst.csuchico.edu' with origin from 'ai-web.ecst.csuchico.edu'.
      at netscape.security.AppletSecurity.checkConnect(AppletSecurity.java:914)
      at netscape.security.AppletSecurity.checkConnect(AppletSecurity.java:926)
      at netscape.security.AppletSecurity.checkConnect(AppletSecurity.java:795)
      at java.lang.SecurityManager.checkConnect(SecurityManager.java:718)
      at sun.rmi.transport.tcp.TCPEndpoint.(TCPEndpoint.java:124)
      at sun.rmi.registry.RegistryHandler.registryStub(RegistryHandler.java:58)
      at java.rmi.registry.LocateRegistry.getRegistry(LocateRegistry.java:113)
      at java.rmi.Naming.getRegistry(Naming.java:156)
    * at java.rmi.Naming.lookup(Naming.java:55)
      at examples.hello.HelloApplet.init(HelloApplet.java:21)
      at netscape.applet.DerivedAppletFrame$InitAppletEvent.dispatch(DerivedAppletFrame.java:553)
      at java.awt.EventDispatchThread$EventPump.dispatchEvents(EventDispatchThread.java:81)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:135)
      at netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(DerivedAppletFrame.java:911)
    HelloApplet exception: security.Couldn't connect to 'pip.ecst.csuchico.edu' with origin from 'ai-web.ecst.csuchico.edu'.
    netscape.security.AppletSecurityException: security.Couldn't connect to 'pip.ecst.csuchico.edu' with origin from 'ai-web.ecst.csuchico.edu'.
      at netscape.security.AppletSecurity.checkConnect(AppletSecurity.java:914)
      at netscape.security.AppletSecurity.checkConnect(AppletSecurity.java:926)
      at netscape.security.AppletSecurity.checkConnect(AppletSecurity.java:795)
      at java.lang.SecurityManager.checkConnect(SecurityManager.java:718)
      at sun.rmi.transport.tcp.TCPEndpoint.(TCPEndpoint.java:124)
      at sun.rmi.registry.RegistryHandler.registryStub(RegistryHandler.java:58)
      at java.rmi.registry.LocateRegistry.getRegistry(LocateRegistry.java:113)
      at java.rmi.Naming.getRegistry(Naming.java:156)
    * at java.rmi.Naming.lookup(Naming.java:55)
      at examples.hello.HelloApplet.init(HelloApplet.java:21)
      at netscape.applet.DerivedAppletFrame$InitAppletEvent.dispatch(DerivedAppletFrame.java:553)
      at java.awt.EventDispatchThread$EventPump.dispatchEvents(EventDispatchThread.java:81)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:135)
      at netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(DerivedAppletFrame.java:911)
    
    

    When I tried to change the applet to an application I run the application and get weird since first thing it talks about is helloApplet??? HelloApplet exception: error unmarshalling return; nested exception is: java.io.InvalidClassException: examples.hello.HelloImpl_Stub; Local class not compatible: stream classdesc serialVersionUID=4635722270992699912 local class serialVersionUID=2 java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.InvalidClassException: examples.hello.HelloImpl_Stub; Local class not compatible: stream classdesc serialVersionUID=4635722270992699912 local class serialVersionUID=2 java.io.InvalidClassException: examples.hello.HelloImpl_Stub; Local class not compatible: stream classdesc serialVersionUID=4635722270992699912 local class serialVersionUID=2 at java.lang.Throwable.fillInStackTrace(Native Method) at java.lang.Throwable.(Throwable.java:94) at java.lang.Exception.(Exception.java:42) at java.io.IOException.(IOException.java:47) at java.io.ObjectStreamException.(ObjectStreamException.java:29) at java.io.InvalidClassException.(InvalidClassException.java:47) at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:438) at java.io.ObjectStreamClass.setClass(Compiled Code) at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:785) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:353) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232) at java.io.ObjectInputStream.inputObject(Compiled Code) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at java.rmi.Naming.lookup(Naming.java:89) at examples.hello.HelloApp.main(HelloApp.java:22) blank