RuedigerMoeller / fast-serialization

FST: fast java serialization drop in-replacement
Apache License 2.0
1.59k stars 247 forks source link

Class loader exeception #239

Closed NomadicDeveloper22 closed 6 years ago

NomadicDeveloper22 commented 6 years ago

Exeception:

Exception in thread "Thread-368" java.lang.NoClassDefFoundError: org/objenesis/Objenesis
    at org.nustaq.serialization.FSTObjectOutput.<init>(FSTObjectOutput.java:85)
    at com.TheRedSpy15.trail.Gang.saveData(Gang.java:82)
    at com.TheRedSpy15.trail.Main.saveGameState(Main.java:166)
    at com.TheRedSpy15.trail.TravelController.lambda$TravelTask$2(TravelController.java:121)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.objenesis.Objenesis
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 5 more

Note: I'm using IntelliJ and have added the library as a jar/external library without the use of a build manager such as Maven or Gradle

Code where exeception is happening:

static void saveData() throws IOException {

        FileOutputStream fileOutputStream = new FileOutputStream("SaveGame.ser");
        FSTObjectOutput objectOutputStream = new FSTObjectOutput(fileOutputStream);

        objectOutputStream.writeObject(Main.gang);
        objectOutputStream.writeObject(Main.gang.gangMembers);
        objectOutputStream.writeObject(Main.gang.deceased);

        objectOutputStream.close();
        fileOutputStream.close();
    }
RuedigerMoeller commented 6 years ago

fst has some dependencies, check the releases tab for a all-included jar

NomadicDeveloper22 commented 6 years ago

Little late on seeing this. I have decided to go with Gson instead of FST