I have a program that sends POJO from a server to a client. For primitive data types like String[]
or Boolean
it works fine. When I create a custom data type with just getters and setters, send it from server to client and try to cast it from a Java Object to my data type I get exception:
java.lang.ClassCastException: java.lang.Object cannot be cast to com.ais.sqar.datatypes.Udata
Where on both instances of the client and server I can cast just fine. It seems when I push it across an ObjectOutputStream
something strange happens. I have also serialized object as well. Any gotchas here with ObjectOutputStreams?