Jump to content

Anyone who has used Kryo HELP


Valkyr

Recommended Posts

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...