Intellij IDEA: need help with building jar with included Maven project

I have a Java project with included Maven Project.
I create Aftifact Jar in Project Structure -> Artifacts.
Both modules outputs are included in the artifact.
After building the jar, I execute the following command line:

$ java -jar myJar.jar

The error message is following:
Exception in thread "main" java.lang.NoClassDefFoundError: io/netty/util/concurrent/EventExecutorGroup
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at SaveUserData.main(SaveUserData.java:72)
Caused by: java.lang.ClassNotFoundException: io.netty.util.concurrent.EventExecutorGroup
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more

SaveUserData.java line 72 is the call of Class from included project. Seems, it doesn’t find the class path of the included project.

If you have any ideas, why it is working like this, I really appreciate any help.

Thank you in advance.

Update: The problem was, that dependent libraries of included project were not extracted to target jar artifact file. After I extracted all required libraries to the artifact – everything worked well.

1 comment

  1. netty.jar is missing in classpath. In fact, you haven’t specified the classpath in your command line and you most likely did not define it in the manifest. Hence the error.

Leave a Reply

%d bloggers like this: