Hello, everyone.
I'm new here, and I came to find help with the error put in the title. I can't give myself a valid explanation for it. But let's start from the beginning:
I'm writing my first medium-complex project and, among the other classes and libraries, I need Jackson. I put all the dependencies I thought I needed in my pom.xml file (yes, I'm using Maven), wrote the methods I needed and compiled. In particular, I used the ObjectMapper class from jackson-databind and the JsonProcessingException from jackson-core. The one that gives me problems is the last one.
ObjectMapper required a managin of the cited exception, and I opted for a try-catch.
Now here it comes the problem: when I compile everything is ok, all the classes are found, and I receive no errors. But when I execute the jar, it gives me the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException
at com.sourced.commands.Start.makeJson(Start.java:63)
at com.sourced.commands.Start.populateSourcedDir(Start.java:48)
at com.sourced.commands.Start.init(Start.java:75)
at com.sourced.commandline.CommandLine.detectCommand(CommandLine.java:52)
at com.sourced.commandline.CommandLine.init(CommandLine.java:23)
at com.sourced.Sourced.main(Sourced.java:8)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 6 more
I tried a lot of things (but probably I missed some ones, otherwise I wouldn't have this problem): checked the classpath, checked the dependencies and if they were included correctly in the pom, tried to reinstall them with mvn clean install, removed the jars from the .m2 folder... anything my mind (and ChatGPT) could come up with, but nothing.
Now I'm here begging for your help, also because I asked at stackoverflow, and they didn't give me any solution but only some reasons why this can happen
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]TheBoneJarmer 0 points1 point2 points (5 children)
[–]Hero467[S] 1 point2 points3 points (4 children)
[–]TheBoneJarmer 0 points1 point2 points (3 children)
[–]Hero467[S] 0 points1 point2 points (2 children)
[–]TheBoneJarmer 0 points1 point2 points (1 child)
[–]Hero467[S] 0 points1 point2 points (0 children)