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.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.lang.ClassNotFoundException: client.testobject (no security manager: RMI class loader disabled)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:595)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
      at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
      at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
      at $Proxy0.pass(Unknown Source)
      at client.clientTest.Connect(clientTest.java:35)
      at client.clientTest.<init>(clientTest.java:26)
      at client.Main.main(Main.java:23)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.lang.ClassNotFoundException: client.testProc (no security manager: RMI class loader disabled)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:285)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: client.testProc (no security manager: RMI class loader disabled)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
      at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
      at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.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
sunny012097Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kiranhkCommented:
you need to have the security Manager set for your client..

or use this while starting your RMI server

java -Djava.security.manager -Djava.security.policy=policy-file MyClass



http://www.ccs.neu.edu/home/kenb/com3337/rmi_tut.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sunny012097Author Commented:
 
  now getting exceptions again. Here is stack:



java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.io.InvalidClassException: common.Process; local class incompatible: stream classdesc serialVersionUID = -7788712377034963467, local class serialVersionUID = 2506602152668479765
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:595)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
      at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
      at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
      at $Proxy0.submit(Unknown Source)
      at kernel.applications.NetworkManager.run(NetworkManager.java:80)
      at java.lang.Thread.run(Thread.java:595)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.io.InvalidClassException: common.Process; local class incompatible: stream classdesc serialVersionUID = -7788712377034963467, local class serialVersionUID = 2506602152668479765
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:282)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      ... 1 more
Caused by: java.io.InvalidClassException: common.Process; local class incompatible: stream classdesc serialVersionUID = -7788712377034963467, local class serialVersionUID = 2506602152668479765
      at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:279)
      ... 6 more
0
CodingExpertsCommented:
Does your CLASS_A class implements Serializable interface ???

-CE
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

CodingExpertsCommented:
I am sorry... please ignore my previous post ...
0
CodingExpertsCommented:
May be u find this url of some use ....

http://www.tek-tips.com/viewthread.cfm?qid=947659&page=1

-CE
0
girionisCommented:
> Caused by: java.io.InvalidClassException: 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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.