This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Problem: in.readObject() throws a ClassNotFoundException exception because it can't find the class a.package.path.CommandMessage.
I'm sending a serialized object via socket; using writeObject(), readObject(). There are now two versions of the same system that are communicating with one another; one prototype version in which no packages were defined, and a newer version in which classes have been moved into packages.
I am sending a java object (class name: CommandMessage) from the new version with packages to the old version without. The class is defined the same way in both versions, except for the package path.
In other words:
NewSystem: out.writeObject(a.package.path.CommandMessage commandMessage) -> OldSystem: CommandMessage commandMessage = in.readObject() in a system where CommandMessage is in an unnamed package (no package defined).
in.readObj() throws a ClassNotFoundException exception because it can't find the class a.package.path.CommandMessage.
If there's some way to beat this problem, I'd certainly like to know. I'm preparing to Open Source the system. It's a young system and maybe things will be shifted around into new and different packages from time to time for a while.