[Solved] Hashmap [FieldSerializer][?] Exception occurred on writing

Hi, I’m trying to send a hashmap from server to client but it gives me rather large warning/error, I ain’t sure it’s the hashmap causing the error though. The error also says PlayersData isn’t registered, but I ain’t sending that class, only getting the hashmap out of it and putting it in UpdateFromServerMessage, so I can send that class.


[java]WARNING: [FieldSerializer][???] Exception occurred on writing. Maybe you’ve forgotten to register a class, or maybe a class member does not have a serializer.

9-mei-2011 19:04:12 com.jme3.app.Application handleError

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.RuntimeException: Error serializing message

at com.jme3.network.base.MessageProtocol.messageToBuffer(MessageProtocol.java:82)

at com.jme3.network.base.DefaultServer.broadcast(DefaultServer.java:157)

at com.jme3.network.base.DefaultServer.broadcast(DefaultServer.java:152)

at mygame.Main.simpleUpdate(Main.java:134)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:248)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:143)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:171)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:217)

at java.lang.Thread.run(Thread.java:662)

Caused by: com.jme3.network.serializing.SerializerException: Error writing object

at com.jme3.network.serializing.serializers.FieldSerializer.writeObject(FieldSerializer.java:171)

at com.jme3.network.serializing.Serializer.writeClassAndObject(Serializer.java:362)

at com.jme3.network.base.MessageProtocol.messageToBuffer(MessageProtocol.java:74)

… 8 more

Caused by: java.lang.IllegalArgumentException: Class has not been registered:class network.PlayersData

at com.jme3.network.serializing.Serializer.getSerializerRegistration(Serializer.java:296)

at com.jme3.network.serializing.Serializer.getSerializerRegistration(Serializer.java:265)

at com.jme3.network.serializing.Serializer.writeClass(Serializer.java:340)

at com.jme3.network.serializing.serializers.MapSerializer.writeObject(MapSerializer.java:171)

at com.jme3.network.serializing.Serializer.writeClassAndObject(Serializer.java:362)

at com.jme3.network.serializing.serializers.FieldSerializer.writeObject(FieldSerializer.java:165)

… 10 more[/java]


[java] @Override

public void simpleUpdate(float tpf) {

if (running) {

HashMap data = PlayersData.getPlayersData();

if (!data.isEmpty()) {

server.broadcast(new UpdateFromServerMessage(data)); //line 134






public class UpdateFromServerMessage extends AbstractMessage {

public HashMap data;

public UpdateFromServerMessage(){


public UpdateFromServerMessage(HashMap data) {

this.data = data;




I don’t think I forgot something in the message… The only thing I can come up with is that hashmap isn’t serializable… somebody can confirm this or help me with telling what I did wrong?

Ok, I found the solution… I just registered PlayerData, like the error told me to do :p… but why do I needed to do this? I thought it was for sending them over the network

If it was complaining about PlayerData then you are trying to send PlayerData. It cannot magically somehow know about this class. My guess is that PlayerData must be in the hashmap.