Issue
I added dependency of a custom jar(say some-jar.jar) in a module's pom.xml where I need to write my code inside say CustomClass.java. Now, some-jar.jar contains AnotherClass.class which I need to use in my code.
After I finish my code, build succeeds and I am able to successfully deploy the application.
But when the execution reaches my code, it throws an ERROR(not an exception) saying
java.lang.NoClassDefFoundError: com/some/package/AnotherClass
. . . and the usual stack trace.
I understand this is happening because JVM is not able to locate this file at Runtime even though at compile time it was located, but what is the solution here? What do I need to do to make it available at Runtime.
Unfortunately, due to some restrictions I cannot disclose any more information than this issue. Lets see, if it is even required.
Solution
You can either specify your dependencies in classpath like this or make a fat jar (google it)
Answered By - yyyy