NoClassDefFoundError: com/typesafe/config/ConfigMergeable

I’ve built a simple Akka system with dependencies on Akka cluster libraries as follows (my Maven pom file):

<dependencies>
    <dependency>
      <groupId>com.typesafe.akka</groupId>
      <artifactId>akka-cluster-tools_2.12</artifactId>
      <version>2.5.23</version>
    </dependency>
    <dependency>
      <groupId>com.typesafe.akka</groupId>
      <artifactId>akka-cluster-metrics_2.12</artifactId>
      <version>2.5.23</version>
    </dependency>
<dependency>
  <groupId>com.typesafe.akka</groupId>
  <artifactId>akka-stream_2.12</artifactId>

  <version>2.5.23</version>
</dependency>

I can run the cluster just find from Maven, but when I create an executable jar file and try to run it that way I get an Exception in thread “main” java.lang.NoClassDefFoundError: com/typesafe/config/ConfigMergeable.

Since the samples run just fine using the same dependencies, and my code runs just fine when I execute the main method from Maven, I can’t figure out why the TypeSafe Config library isn’t being included when I package the jar file. Shouldn’t it be part of the core Akka dependencies already?

it is a dependency of Akka. Without more information I’d guess whatever you’re building an executable jar with is not including all transitive dependencies correctly. That class has been in the library for years so I doubt it is a version mismatch issue.

What approach are you taking for building the executable jar?

Strange that all of my previous Akka projects compiled and packaged correctly without it, but I switched to using the Shade plug-in for Maven and solved the problem. The executable jar now runs find with no missing dependencies. The only thing different was going from 2.5.22 to 2.5.23 for this project, so I do wonder if somebody changed a dependency somewhere with these three core artifacts.