sunny012097
asked on
RMI object passing problem
hi experts,
in my rmi application, i want to sent server CLASS_A type objects and i designed server interface that way, then at the client side i wrote objects extending CLASS_A so that they would have common methods and be recognized by the rmi server. The problem is there is sometihng wrong and i get the following exception:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalExceptio n: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundExc eption: client.testobject (no security manager: RMI class loader disabled)
at sun.rmi.server.UnicastServ erRef.disp atch(Unica stServerRe f.java:325 )
at sun.rmi.transport.Transpor t$1.run(Tr ansport.ja va:153)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at sun.rmi.transport.Transpor t.serviceC all(Transp ort.java:1 49)
at sun.rmi.transport.tcp.TCPT ransport.h andleMessa ges(TCPTra nsport.jav a:460)
at sun.rmi.transport.tcp.TCPT ransport$C onnectionH andler.run (TCPTransp ort.java:7 01)
at java.lang.Thread.run(Threa d.java:595 )
at sun.rmi.transport.StreamRe moteCall.e xceptionRe ceivedFrom Server(Str eamRemoteC all.java:2 47)
at sun.rmi.transport.StreamRe moteCall.e xecuteCall (StreamRem oteCall.ja va:223)
at sun.rmi.server.UnicastRef. invoke(Uni castRef.ja va:126)
at java.rmi.server.RemoteObje ctInvocati onHandler. invokeRemo teMethod(R emoteObjec tInvocatio nHandler.j ava:179)
at java.rmi.server.RemoteObje ctInvocati onHandler. invoke(Rem oteObjectI nvocationH andler.jav a:132)
at $Proxy0.pass(Unknown Source)
at client.clientTest.Connect( clientTest .java:35)
at client.clientTest.<init>(c lientTest. java:26)
at client.Main.main(Main.java :23)
Caused by: java.rmi.UnmarshalExceptio n: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundExc eption: client.testProc (no security manager: RMI class loader disabled)
at sun.rmi.server.UnicastServ erRef.disp atch(Unica stServerRe f.java:285 )
at sun.rmi.transport.Transpor t$1.run(Tr ansport.ja va:153)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at sun.rmi.transport.Transpor t.serviceC all(Transp ort.java:1 49)
at sun.rmi.transport.tcp.TCPT ransport.h andleMessa ges(TCPTra nsport.jav a:460)
at sun.rmi.transport.tcp.TCPT ransport$C onnectionH andler.run (TCPTransp ort.java:7 01)
at java.lang.Thread.run(Threa d.java:595 )
Caused by: java.lang.ClassNotFoundExc eption: client.testProc (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandl er.loadCla ss(LoaderH andler.jav a:371)
at sun.rmi.server.LoaderHandl er.loadCla ss(LoaderH andler.jav a:165)
at java.rmi.server.RMIClassLo ader$2.loa dClass(RMI ClassLoade r.java:620 )
at java.rmi.server.RMIClassLo ader.loadC lass(RMICl assLoader. java:247)
at sun.rmi.server.MarshalInpu tStream.re solveClass (MarshalIn putStream. java:197)
at java.io.ObjectInputStream. readNonPro xyDesc(Obj ectInputSt ream.java: 1538)
at java.io.ObjectInputStream. readClassD esc(Object InputStrea m.java:146 0)
at java.io.ObjectInputStream. readOrdina ryObject(O bjectInput Stream.jav a:1693)
at java.io.ObjectInputStream. readObject 0(ObjectIn putStream. java:1299)
at java.io.ObjectInputStream. readObject (ObjectInp utStream.j ava:339)
at sun.rmi.server.UnicastRef. unmarshalV alue(Unica stRef.java :290)
at sun.rmi.server.UnicastServ erRef.disp atch(Unica stServerRe f.java:279 )
... 6 more
I don't know what is wrong i spent hour but i couldn't figure out the problem.
Does any body can post some usefull code doing the job i said above, i need a base class for sending between nodes and ii want to have other classes extending base class and be able to passed to an rmi server.
thanks
in my rmi application, i want to sent server CLASS_A type objects and i designed server interface that way, then at the client side i wrote objects extending CLASS_A so that they would have common methods and be recognized by the rmi server. The problem is there is sometihng wrong and i get the following exception:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalExceptio
java.lang.ClassNotFoundExc
at sun.rmi.server.UnicastServ
at sun.rmi.transport.Transpor
at java.security.AccessContro
at sun.rmi.transport.Transpor
at sun.rmi.transport.tcp.TCPT
at sun.rmi.transport.tcp.TCPT
at java.lang.Thread.run(Threa
at sun.rmi.transport.StreamRe
at sun.rmi.transport.StreamRe
at sun.rmi.server.UnicastRef.
at java.rmi.server.RemoteObje
at java.rmi.server.RemoteObje
at $Proxy0.pass(Unknown Source)
at client.clientTest.Connect(
at client.clientTest.<init>(c
at client.Main.main(Main.java
Caused by: java.rmi.UnmarshalExceptio
java.lang.ClassNotFoundExc
at sun.rmi.server.UnicastServ
at sun.rmi.transport.Transpor
at java.security.AccessContro
at sun.rmi.transport.Transpor
at sun.rmi.transport.tcp.TCPT
at sun.rmi.transport.tcp.TCPT
at java.lang.Thread.run(Threa
Caused by: java.lang.ClassNotFoundExc
at sun.rmi.server.LoaderHandl
at sun.rmi.server.LoaderHandl
at java.rmi.server.RMIClassLo
at java.rmi.server.RMIClassLo
at sun.rmi.server.MarshalInpu
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at sun.rmi.server.UnicastRef.
at sun.rmi.server.UnicastServ
... 6 more
I don't know what is wrong i spent hour but i couldn't figure out the problem.
Does any body can post some usefull code doing the job i said above, i need a base class for sending between nodes and ii want to have other classes extending base class and be able to passed to an rmi server.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Does your CLASS_A class implements Serializable interface ???
-CE
-CE
I am sorry... please ignore my previous post ...
May be u find this url of some use ....
http://www.tek-tips.com/viewthread.cfm?qid=947659&page=1
-CE
http://www.tek-tips.com/viewthread.cfm?qid=947659&page=1
-CE
> Caused by: java.io.InvalidClassExcept ion: common.Process; local class
> incompatible
This exception is thrown when you try to deserialie (unmarshal) an object you have received from a remote machien. It basically means that the version of the class in the error message is different between the two JVMs.
See also this message:
> stream classdesc serialVersionUID = -7788712377034963467, local class serialVersionUID = 2506602152668479765
they have different serialVersionUID.
Things to check:
1) Both computers have the exact same versin of JVM
2) Check that you have the proper jar files in your classpath
3) If all else fails you can try to manually add the serialVersionUID to the class itself by doing:
static final long serialVersionUID = <the serialization numeber>L;
If you need more info about serialization have a look here: http://www.acm.org/crossroads/xrds4-2/serial.html
> incompatible
This exception is thrown when you try to deserialie (unmarshal) an object you have received from a remote machien. It basically means that the version of the class in the error message is different between the two JVMs.
See also this message:
> stream classdesc serialVersionUID = -7788712377034963467, local class serialVersionUID = 2506602152668479765
they have different serialVersionUID.
Things to check:
1) Both computers have the exact same versin of JVM
2) Check that you have the proper jar files in your classpath
3) If all else fails you can try to manually add the serialVersionUID to the class itself by doing:
static final long serialVersionUID = <the serialization numeber>L;
If you need more info about serialization have a look here: http://www.acm.org/crossroads/xrds4-2/serial.html
ASKER
now getting exceptions again. Here is stack:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalExceptio
java.io.InvalidClassExcept
at sun.rmi.server.UnicastServ
at sun.rmi.transport.Transpor
at java.security.AccessContro
at sun.rmi.transport.Transpor
at sun.rmi.transport.tcp.TCPT
at sun.rmi.transport.tcp.TCPT
at java.lang.Thread.run(Threa
at sun.rmi.transport.StreamRe
at sun.rmi.transport.StreamRe
at sun.rmi.server.UnicastRef.
at java.rmi.server.RemoteObje
at java.rmi.server.RemoteObje
at $Proxy0.submit(Unknown Source)
at kernel.applications.Networ
at java.lang.Thread.run(Threa
Caused by: java.rmi.UnmarshalExceptio
java.io.InvalidClassExcept
at sun.rmi.server.UnicastServ
at sun.rmi.transport.Transpor
at java.security.AccessContro
at sun.rmi.transport.Transpor
at sun.rmi.transport.tcp.TCPT
at sun.rmi.transport.tcp.TCPT
... 1 more
Caused by: java.io.InvalidClassExcept
at java.io.ObjectStreamClass.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at sun.rmi.server.UnicastRef.
at sun.rmi.server.UnicastServ
... 6 more