Problem sending data

Okay, I have my message class `

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

  • @author Arturo
    */
    @Serializable
    public class UpdateClientMessage extends AbstractMessage
    {
    private String greeting = “Hello SpiderMonkey!”; // your message data
    public UpdateClientMessage() { } // empty default constructor
    public UpdateClientMessage(String s)
    { // custom constructor
    greeting = s;
    }
    public void setGreeting(String s)
    {
    greeting = s;
    }
    public String getGreeting()
    {
    return greeting;
    }
    }
    `
    and I’m trying to send it over the network (I have set up the server and client and all that jazz). Now when this is my message class, it works perfectly. However, this was an early test as I am new to networking, so now I’ve added some so I’m able to send floats over as well. This is where it all goes to hell. Even if I don’t do a thing with the floats (besides declaring the float), the application breaks and tells me there was a problem deserializing the object, and the application loses connection to the server (however the app stills run). Please help?

Sounds like you updated the class on one side and not the other.

The app still runs because you haven’t registered a listener to detect the connection going down and kill the app.

Also, it’s interesting that you’ve chosen to only show the code that worked and not the code that didn’t. Usually, sharing more is better… we can’t guess what you might have done and it would be a mistake for us to assume.

Also, the actual error plus stack trace might be useful.

Ok well the fact that it isn’t shutting down isn’t really a problem to me just yet (although thank you for saying how to fix it).

And here’s the error I get:

Nov 21, 2014 4:11:11 AM com.jme3.network.base.DefaultClient handleError
SEVERE: Termining connection due to unhandled error
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.ConnectorAdapter.run(ConnectorAdapter.java:169)
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)
	... 2 more

Also what do you mean by “Sounds like you updated the class on one side and not the other.”?

And what other code would be helpful to see? I’m not all to sure why this problem is happening so I don’t know what to show you. Especially because sometimes the app runs beautifully (connects to the server, gets the updates, runs like a charm), but other times I get this error, so I don’t understand why it only happens sometimes.

Thanks!

I mean that it sounds like the client and server don’t match.

Do you register all of your message classes with the serializer in one central place to make sure that they are always registered in the EXACT same order? Are your client and server in the same codebase?

The error indicates that something doesn’t match between the client and the server.