Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

invalid method hash error - Can someone explain this?

843793Dec 4 2007 — edited Dec 4 2007
I am relatively new to RMI and as such have been greeted which many errors. However while most of them were easy enough to solve I have been stuck with the following error for quite a while.

The error is:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
	java.rmi.UnmarshalException: invalid method hash
	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:466)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
	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.loadCustomer(Unknown Source)
	at Database.DbAccess.loadCustomers(DbAccess.java:85)
	at Gui.Interface.main(Interface.java:93)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.rmi.UnmarshalException: invalid method hash
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:266)
	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:466)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
	at java.lang.Thread.run(Thread.java:595)
Basically, some methods I call via RMI work perfectly, while others throw errors such as the one above. I have read a few other similar posts, and I gather certain "stubs" may need updating? I'm not sure what that envolves though - or whether that is the problem at all.

I'm not sure whether its worth noting however, the few methods which do work return Strings, while the method which threw the above exception returns a Vector of type "Customer" (a class I have defined myself - and have included an extract of below).
public class Customer implements java.io.Serializable {

    private static final long serialVersionUID = 73625183L;

    public String customerID;
	public String forename;
	public String surname;
    public String dob;
    public String phoneNumber;

    public Customer(String aCustomerID, String aForename, String aSurname, String aDob, String aPhoneNumber) {
		this.customerID = aCustomerID;
        this.forename = aForename;
        this.surname = aSurname;
        this.dob = aDob;
        this.phoneNumber = aPhoneNumber;
    }
I have a copy of the classes I reurn in both the server and client programs and also included a "serialVersionUID" for each class, but to no avail.

Does anyone know what may be the cause?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 1 2008
Added on Dec 4 2007
3 comments
1,852 views