RMI compiling error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kirara
    New Member
    • Dec 2006
    • 19

    #1

    RMI compiling error

    Hello,

    I am new to rmi and linux enviroment, I have been trying to test this code (java) on uinx where there
    are three machines:
    -One as a Controller
    -an execution host
    - a submitter

    I do the following to run them:
    - type "make" in all the machines to compile the all the java classes along with the remote objects.
    - then run rmiregistry on all the machines
    - then run the Controller class
    - run the host class the reports to the Controller periodecally
    - submit an application

    the problem is when I run the Host class it gives me the following exceptions:
    [user@machine1 code]$ java Host 10.70.50.99
    Binding Report failed: java.rmi.Server Exception: RemoteException occurred in server thread; nested exception is:
    java.rmi.Unmars halException: error unmarshalling arguments; nested exception is:
    java.lang.Class NotFoundExcepti on: Report_Stub
    Binding Runn failed: java.rmi.Server Exception: RemoteException occurred in server thread; nested exception is:
    java.rmi.Unmars halException: error unmarshalling arguments; nested exception is:
    java.lang.Class NotFoundExcepti on: Runn_Stub

    I use jdk1.5 on all the machines althought the code is written with jdk1.4 is that affecting the compiling??
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    You should run the rmic compiler for the Runn and Report files. The compiler
    generates stubs for those classes; store thos stubes in the classpaths on the
    hosts that reported the Exceptions. btw, it has nothing to do with Java 1.4 or
    Java 1.5. Very old versions of Java (1.2 or so) also needed skeleton files but
    you don't need those anymore.

    kind regards,

    Jos

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by JosAH
      You should run the rmic compiler for the Runn and Report files. The compiler
      generates stubs for those classes; store thos stubes in the classpaths on the
      hosts that reported the Exceptions. btw, it has nothing to do with Java 1.4 or
      Java 1.5. Very old versions of Java (1.2 or so) also needed skeleton files but
      you don't need those anymore.

      kind regards,

      Jos
      Please don't remind us of the skeletons.

      Comment

      • kirara
        New Member
        • Dec 2006
        • 19

        #4
        I have runned the rmic for both the Runn and the Report classes, and then I runned the Host class that uses those two but I am still getting the same
        error...any thoughts?

        Comment

        • kirara
          New Member
          • Dec 2006
          • 19

          #5
          I can see the the Runn_Stub.class and the Report_stub.cla ss
          but still the host class give me the same exceptions, does have to do with loading these stubs?

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Are those classes reachable through the classpath?

            kind regards,

            Jos

            Comment

            • kirara
              New Member
              • Dec 2006
              • 19

              #7
              they are in same path as the Host class, but is there a way for me to check it?

              Comment

              • JosAH
                Recognized Expert MVP
                • Mar 2007
                • 11453

                #8
                Originally posted by kirara
                they are in same path as the Host class, but is there a way for me to check it?
                Yup, I can't tell anything in detail from here but store those stub classes on
                every single machine that is part of your experiment. Those classes should
                be reachable through the machine's classpaths. It sould work then. Afterwards,
                one by one remove the stubs and see which of your hosts need those stub
                classes.

                kind regards,

                Jos

                Comment

                • kirara
                  New Member
                  • Dec 2006
                  • 19

                  #9
                  this is what I have done:
                  shell1:
                  ran the rmiregistry on all the machines
                  shell2:
                  ran the rmic for Report and Runn
                  shell3:
                  ran the host class
                  but now I have another exception:

                  Exception in thread "main" java.rmi.Connec tException: Connection refused to host: 10.70.50.99; nested exception is:
                  java.net.Connec tException: Connection refused
                  at sun.rmi.transpo rt.tcp.TCPEndpo int.newSocket(T CPEndpoint.java :574)
                  at sun.rmi.transpo rt.tcp.TCPChann el.createConnec tion(TCPChannel .java:185)
                  at sun.rmi.transpo rt.tcp.TCPChann el.newConnectio n(TCPChannel.ja va:171)
                  at sun.rmi.server. UnicastRef.invo ke(UnicastRef.j ava:94)
                  at Report_Stub.ini t(Unknown Source)
                  at Host.main(HostD aemon.java:51)
                  Caused by: java.net.Connec tException: Connection refused
                  at java.net.PlainS ocketImpl.socke tConnect(Native Method)
                  at java.net.PlainS ocketImpl.doCon nect(PlainSocke tImpl.java:333)
                  at java.net.PlainS ocketImpl.conne ctToAddress(Pla inSocketImpl.ja va:195)
                  at java.net.PlainS ocketImpl.conne ct(PlainSocketI mpl.java:182)
                  at java.net.SocksS ocketImpl.conne ct(SocksSocketI mpl.java:366)
                  at java.net.Socket .connect(Socket .java:516)
                  at java.net.Socket .connect(Socket .java:466)
                  at java.net.Socket .<init>(Socket. java:366)
                  at java.net.Socket .<init>(Socket. java:179)
                  at sun.rmi.transpo rt.proxy.RMIDir ectSocketFactor y.createSocket( RMIDirectSocket Factory.java:22 )
                  at sun.rmi.transpo rt.proxy.RMIMas terSocketFactor y.createSocket( RMIMasterSocket Factory.java:12 8)
                  at sun.rmi.transpo rt.tcp.TCPEndpo int.newSocket(T CPEndpoint.java :569)
                  ... 5 more

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    At least your JVMs found the stubs. The connection to the peer at the other
                    side of the wire refused the connection: either a fire wall problem or a wrong
                    IP address. Maybe another server isn't running? Start your processes at the
                    server side(s) then start your clients.

                    kind regards,

                    Jos

                    ps. if all else fails see if you can 'ping' the other side(s).

                    Comment

                    • kirara
                      New Member
                      • Dec 2006
                      • 19

                      #11
                      hi again I appreciate your replies,

                      I have runned the server side first(Controlle r class) then the client(Host class)
                      the stubs of the host class are found and the controller is working fine,
                      BUT the host class give me this exception:
                      Exception in thread "main" java.rmi.NotBou ndException: Registrar
                      at sun.rmi.registr y.RegistryImpl. lookup(Registry Impl.java:106)
                      at sun.rmi.registr y.RegistryImpl_ Skel.dispatch(U nknown Source)
                      at sun.rmi.server. UnicastServerRe f.oldDispatch(U nicastServerRef .java:375)
                      at sun.rmi.server. UnicastServerRe f.dispatch(Unic astServerRef.ja va:240)
                      at sun.rmi.transpo rt.Transport$1. run(Transport.j ava:153)
                      at java.security.A ccessController .doPrivileged(N ative Method)
                      at sun.rmi.transpo rt.Transport.se rviceCall(Trans port.java:149)
                      at sun.rmi.transpo rt.tcp.TCPTrans port.handleMess ages(TCPTranspo rt.java:466)
                      at sun.rmi.transpo rt.tcp.TCPTrans port$Connection Handler.run(TCP Transport.java: 707)
                      at java.lang.Threa d.run(Thread.ja va:595)
                      at sun.rmi.transpo rt.StreamRemote Call.exceptionR eceivedFromServ er(StreamRemote Call.java:247)
                      at sun.rmi.transpo rt.StreamRemote Call.executeCal l(StreamRemoteC all.java:223)
                      at sun.rmi.server. UnicastRef.invo ke(UnicastRef.j ava:343)
                      at sun.rmi.registr y.RegistryImpl_ Stub.lookup(Unk nown Source)
                      at java.rmi.Naming .lookup(Naming. java:84)
                      at Host.main(HostD aemon.java:53),

                      the Registrar is a remote object in the Controller class and the Host class tries to look it up

                      Comment

                      • kirara
                        New Member
                        • Dec 2006
                        • 19

                        #12
                        I have a question, I am not sure but is rmiregistry for one machine should be the same as another one (I mean the classpath)?

                        I use this code to in the Host class to lookup the Registrar remote object of the other machine:

                        ri = (RegistrarInter face) Naming.lookup ("//" + args[0] + "/Registrar");
                        where args[0] is the IP of the other machine>>>shoul d I specify the path

                        Comment

                        • JosAH
                          Recognized Expert MVP
                          • Mar 2007
                          • 11453

                          #13
                          Originally posted by kirara
                          I have a question, I am not sure but is rmiregistry for one machine should be the same as another one (I mean the classpath)?

                          I use this code to in the Host class to lookup the Registrar remote object of the other machine:

                          ri = (RegistrarInter face) Naming.lookup ("//" + args[0] + "/Registrar");
                          where args[0] is the IP of the other machine>>>shoul d I specify the path
                          There's no need to specify a path there, i.e. the rmiregistry is just a naming
                          service, i.e. it associates (maps) a name to an object. The object is already
                          there (most of the times 'this') when the the rmiregistry registers it.

                          A registry operates on one host where objects are associated with a name.
                          Other hosts query that/those registries for remote objects. The stubs must
                          be present locally and reachable through the classpath.

                          kind regards,

                          Jos

                          ps. I think about this a bit more when I have some more spare time.
                          Come to think of it: does a VM on host A need a remote object from a VM
                          running on host B and vice versa?

                          Comment

                          Working...