RPC client-server Communication: RuntimeException: Can not deserialize ....

Hello,
I am trying to send a class instance from server to client. As long as the instance is null it is sent to the client and my ClientRpc class is executed and all is ok.
When I actually try to send an instance I receive RuntimeException: Can not deserialize com.abc…gwt.client.MyClass

I tried to simplify the class and now looks like this:


public class MyClass implements Serializable {
	public MyClass() {
		// TODO Auto-generated constructor stub
	}
}

on the server inside my AbstractExtension class implementation I do:


MyClassRpc rpcProxy = getRpcProxy(MyClassRpc.class);
rpcProxy.send(new MyClass());

Then I have MyClassRpc:


public interface MyClassRpc extends ClientRpc {
	void send(MyClass mc);
}

On the client side inside MyClassConnector I have:


private MyClassRpc rpc = new MyClassRpc() {
	@Override
	public void send(MyClass mc) {
		Window.alert("send value=" + mv);
	}
};

If I change the communication class type (the send() method) to String instead of MyClass it works with null or any other string passed.
What do I have to implement to be able to send a custom java class instance to the client part? In GWT you just mark as serializable and you are good to go.

Thank you.

Ok, from what I understand vaadin 7 uses JSON Encoder/Decoder, so do I have to implement something like that to be able to send my custom class instances from the server to client?

Dear Dan,
You need to use the GWT “IsSerializable” interface instead of the Java “Serializable” for the classes that need to be transferred over the wire to the client browser.

Also, take a look at this:
https://developers.google.com/web-toolkit/doc/1.6/DevGuideServerCommunication

This is a very late reply, but: Vaadin 7 uses custom serialization and deserialization for objects transferred over RPC and shared state. The parameter MyClass should work if there is nothing problematic in that class. The code sample here does not tell what could be the issue in MyClass.

Note that only declared (field/parameter) types are used for serialization and deserialization, the actual instance type is not used.