[Kryonet] SerializationException

Ok,
I’ve got a Kryonet server and Kryonet client that runs in a applet (the client is also using jMonkeyEngine, if that makes a difference).

I’m getting this error when trying to connect to the server with Kryonet:

00:00 INFO: Connecting: localhost/127.0.0.1:1345
00:00 ERROR: [kryonet] Error updating connection.
com.esotericsoftware.kryo.SerializationException: Incorrect number of bytes (1 remaining) used to deserialize object: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP@1911540
at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:148)
at com.esotericsoftware.kryonet.Client.update(Client.java:254)
at com.esotericsoftware.kryonet.Client.run(Client.java:332)
at java.lang.Thread.run(Unknown Source)
Exception in thread “Client” com.esotericsoftware.kryo.SerializationException: Incorrect number of bytes (1 remaining) used to deserialize object: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP@1911540
at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:148)
at com.esotericsoftware.kryonet.Client.update(Client.java:254)
at com.esotericsoftware.kryonet.Client.run(Client.java:332)
at java.lang.Thread.run(Unknown Source)

I’m using the exact same version of Kryonet on both the client and server (1.04, the latest)
Any ideas why it’s doing this? If I have a client inside the server, it connects just fine.

Make sure you are registering your network classes in the same order, on both client and server side.

what kalkitus said, and don’t forget to restart your server after you change anything regarding registering objects on kryo

Anyway I think this was happening to me once because I was modifying classes that were registered on kryo.

For example I have a class A which is registered on the client and server obviously, then I start the server and leave it running. After this I added a field in the class A (an integer or whatever) and I tried to connect the client to server, that’s when I got the error because the client and the server have different versions of A.