So I'm writing a webwalker and using Kryo to serialize the web object. The file (as far as I am aware) saves perfectly fine, but when it loads I am presented with the following error:
java.lang.NoClassDefFoundError: com/esotericsoftware/reflectasm/ConstructorAccess
I believe this is caused by the lack of a no-args constructor, though all my classes have one for that specific reason.
Here is the code I am using to load the file:
public static WeightedGraph read(String filename) {
WeightedGraph retrievedObject = new WeightedGraph();
try (Input input = new Input(new FileInputStream(filename))) {
Kryo kryo = new Kryo();
retrievedObject = (WeightedGraph) kryo.readClassAndObject(input);
System.out.println("Retrieved from file: " + retrievedObject.getVertices().size() + " nodes");
} catch (FileNotFoundException ex) {
Logger.getLogger(WeightedGraph.class.getName()).log(Level.SEVERE, null, ex);
}
return retrievedObject;
}
If anyone has used Kryo and experienced a similar problem please respond.