Uploaded image for project: 'Thorntail'
  1. Thorntail
  2. THORN-1431

Swarm WAR misses transitive dependencies -> NoClassDefFoundError

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2017.6.1, 2017.9.4
    • Fix Version/s: 2017.12.1
    • Component/s: None
    • Labels:
      None
    • Story Points:
      1
    • Steps to Reproduce:
      Hide

      Find a reproducer repo here:
      https://github.com/weand/swarm-dependency-bug

      Simply checkout and execute:

      mvn clean package
      

      Then both execution modes will fail with same error.

      • mvn wildfly-swarm:run
      • java -jar target/swarm-dependency-bug-0.0.1-SNAPSHOT-swarm.jar
      Show
      Find a reproducer repo here: https://github.com/weand/swarm-dependency-bug Simply checkout and execute: mvn clean package Then both execution modes will fail with same error. mvn wildfly-swarm:run java -jar target/swarm-dependency-bug-0.0.1-SNAPSHOT-swarm.jar

      Description

      Having a Swarm WAR Module containing dependency...

              <dependency>
                  <groupId>com.nimbusds</groupId>
                  <artifactId>oauth2-oidc-sdk</artifactId>
                  <version>5.24.2</version>
              </dependency>
      

      ... results in NoClassDefFoundError like this:

      Caused by: java.lang.NoClassDefFoundError: Failed to link com/nimbusds/oauth2/sdk/token/BearerAccessToken (Module "deployment.swarm-dependency-bug-0.0.1-SNAPSHOT.war:main" from Service Module Loader): Failed to link com/nimbusds/oauth2/sdk/token/AccessToken (Module "deployment.swarm-dependency-bug-0.0.1-SNAPSHOT.war:main" from Service Module Loader): Failed to link com/nimbusds/oauth2/sdk/token/Token (Module "deployment.swarm-dependency-bug-0.0.1-SNAPSHOT.war:main" from Service Module Loader): Failed to link com/nimbusds/oauth2/sdk/id/Identifier (Module "deployment.swarm-dependency-bug-0.0.1-SNAPSHOT.war:main" from Service Module Loader): net/minidev/json/JSONAware
      

      The dependency mentioned above contains a transitive dependency, which is not packaged into the WAR for the swarm uber jar, and that causes the NoClassDefFoundError for net/minidev/json/JSONAware. It seems to be packed into /m2repo folder.

              <dependency>
                  <groupId>net.minidev</groupId>
                  <artifactId>json-smart</artifactId>
                  <version>1.3.1</version>
              </dependency>
      

      Also declaring this dependency explicitly does not work.

      Only swarm fractions and their transitive dependencies should be removed from the WAR and packed into m2repo?

      I could not find net.minidev.json-smart in any dependency tree of my fractions.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                davidbenninger David Benninger
                Reporter:
                weiseand Andreas Weise
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: