Error deserializing object

Been waiting all day for the forum to come back on so I could ask about this

SO I’ve started again re-coding my game from scratch and I’ve ran into an error I’ve spent hours trying to solve, basically as soon as the client connects to the server he sends his handshake, and as soon as the server receives it, I get this error:

Dec 01, 2013 6:26:34 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.0.3
Dec 01, 2013 6:26:34 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
Dec 01, 2013 6:26:46 PM reportError
SEVERE: Unhandled error, endpoint:NioEndpoint[1, java.nio.channels.SocketChannel[connected local=/ remote=/]], context:Envelope[NioEndpoint[1, java.nio.channels.SocketChannel[connected local=/ remote=/]], reliable, 16]
java.lang.RuntimeException: Error deserializing object
Caused by: Class not found for buffer data.
… 3 more

The server then proceeds to ‘terminate the connection’ according to the clients log
I have registered the message with the serializer on both ends, as well as the server’s listener. Here is the message:

[java]package Main.Messages;



  • @author Dan
    public class Handshake extends AbstractMessage {
    public boolean available;
    public int id;
    public String name;
    public boolean[] alive;
    public String[] names;

    public Handshake(){}


The message is exactly the same one both ends too, I just refactor copied it across, I’ve also tried using the handshake message from the old version of the game, same error. Does anyone know the possible causes of this?

You haven’t registered the class on the server.

I have. Do I have to register the same classes on the server as I do on the client, even if I haven’t used them yet? Though I can’t see how that would affect it, I took out the lines that register the other messages I have created as the server doesn’t register them yet and it works…

Both ends have to have exactly the same messages registered in exactly the same order or the classes won’t get the same IDs and everything goes bad.