I serialize the ArrayList<packageA.Changelog> list to a file and transfer the file to another system on another computer.
And since this is another system that received the file, I do not have the same packageA.Changelog class, but there is packageB.Changelog , which has exactly the same structure, but in a different package.
And when I use
ArrayList<packageB.Changelog> changelogs = (ArrayList<packageB.Changelog>)ois.readObject();
to read from a file, I got a ClassCastException .
How to avoid this exception? Do I need to create the same package structure on another system just to get a list?
source share