1

My colleague has built a JAR from a branch that follows the hierarchy

|COM
|hive (containts 10 .JAR files)
|META-INF
|org
|- 1.jar
|- 2.jar
| ...
|- 46.jar

I have created a JAR from the same branch that omits the hive directory and puts the 10 JAR files in the root.

|COM
|META-INF
|org
|- 1.jar
|- 2.jar
| ...
|- 56.jar

We get the libraries from a lib directory in the root which I link to the project structure like so:

libs

And the lib directory looks partially like this:

lib

When I build the artifact and deploy it to the server and try to run it, I get the error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
        at com.citi.apama.feeds.ApamaFeed.<clinit>(ApamaFeed.java:43)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 1 more

...which references a class which should be in the hive directory in the JAR.

The build steps my colleague follows to build in Eclipse is

File > Export > Runnable Jar file > Library handling: Package required libraries into generated JAR > Finish

I have tried identical steps for Eclipse and for IntelliJ I have followed the steps listed in this answer.

My colleague is building in Eclipse while I have tried both Eclipse and InteliJ to no avail. How can I mimic my colleagues hierarchy?

EDIT

This may be relevant, the non-working JAR has different attributes to the working JAR:

enter image description here

Nanor
  • 2,400
  • 6
  • 35
  • 66

0 Answers0