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 com.jme3.network.base.KernelAdapter reportError
SEVERE: Unhandled error, endpoint:NioEndpoint[1, java.nio.channels.SocketChannel[connected local=/192.168.0.150:27015 remote=/192.168.0.1:54322]], context:Envelope[NioEndpoint[1, java.nio.channels.SocketChannel[connected local=/192.168.0.150:27015 remote=/192.168.0.1:54322]], reliable, 16]
java.lang.RuntimeException: Error deserializing object
at com.jme3.network.base.MessageProtocol.createMessage(MessageProtocol.java:184)
at com.jme3.network.base.MessageProtocol.addBuffer(MessageProtocol.java:160)
at com.jme3.network.base.KernelAdapter.createAndDispatch(KernelAdapter.java:216)
at com.jme3.network.base.KernelAdapter.run(KernelAdapter.java:280)
Caused by: com.jme3.network.serializing.SerializerException: Class not found for buffer data.
at com.jme3.network.serializing.Serializer.readClassAndObject(Serializer.java:356)
at com.jme3.network.base.MessageProtocol.createMessage(MessageProtocol.java:180)
… 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;

import com.jme3.network.AbstractMessage;
import com.jme3.network.serializing.Serializable;

/**
*

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

    public Handshake(){}

}
[/java]

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.