Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting java.rmi.UnmarshalException: unrecognized method hash: method not supported by remote object

 
Renjith mohanan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I am new to RMI technology.

When I am running the rmi client program, I am getting the exception : java.rmi.UnmarshalException: unrecognized method hash: method not supported by remote object.
I am using jdk1.5

The argument of the remote method is the Serialized object.

These are the server code...

This is the Remote Interface



This is the server implementation class

This is the class Order



I have the same Interface and Order class in Client also.

This is the client code


Could any one help me to how can I fix the problem ?

Thanks In Advance
Renjith M

 
Renjith mohanan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Renjith mohanan wrote:Hi Friends,
I am new to RMI technology.

When I am running the rmi client program, I am getting the exception : java.rmi.UnmarshalException: unrecognized method hash: method not supported by remote object.
I am using jdk1.5

The argument of the remote method is the Serialized object.

These are the server code...

This is the Remote Interface



This is the server implementation class

This is the class Order



I have the same Interface and Order class in Client also.

This is the client code


Could any one help me to how can I fix the problem ?

Do I need to set the java.rmi.server.codebase ?
If I do this, what should be the value of the java.rmi.server.codebase and please provide any link or some examples for how to do this ?

Thanks In Advance
Renjith M

 
Bupjae Lee
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your server interface has "getOrder" method, and your server implemention and client use "getOrderFromCash" method

You can modify to match method names, and recompile all classes and try again.
 
Renjith mohanan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bupjae Lee,
thanks for your reply.
Actual that was a mistake from my side. The client code is like this:



Thanks
Renjith M
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Smells like the client and server code are not in sync.
 
Renjith mohanan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nitesh,
Thanks for your reply.
But I really didn;t get your point

"client and server code are not in sync"

could you please explain it.
Actually the problem is not able to pass the Serialized object (in my case that is custom class Order)

Thanks in Advance..

Renjith M
 
Bupjae Lee
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that the problem is serializing Order class.

The error message seems more like "NoSuchMethodException"

'Not in sync' means, there are some 'mismatches' between server and client

Try recompiling interface, server, and client together.
 
Renjith mohanan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bupjae Lee,

I have solved the problem.

I have set the classpath environment variable to the root directory of Order class.

Now I am able to call the remote method from local host.

But I am getting other exception, when trying to execute the remote method from different computer.

One computer is running as the server (eg: server ip is 192.168.1.108).
My client code is exactly like this:


The exception I am getting is:



I don't know, why this error occurs. I am able to ping the two computers and checked the port in the server and it is all working.
The two computers are running in Ubuntu.
But my confusion is why the above exception points to the ip 127.0.1.1 even though I am connecting to the ip 192.168.1.108 (ip of server).

Any Ideas ?

Thanks In Advance

Renjith M



 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is because on your server machine the localhost resolves to 127.0.1.1.
Search for java.rmi.server.hostname here to get more information.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic