Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-4266

Classes for newer versions are not loaded from Multi-Release-JARs in WARs

XMLWordPrintable

    • Hide
      • Deploy buggywar.war to wildfly running on Java 11
      • Open http://localhost:8080/buggywar/Bla
      • The text should be "BlaBla(joined with Java 11)" but is "BlaBla(joined with Java 8)"

      You can verify the working multi-release-JAR by running "java -jar multireleaselib-0.0.1-SNAPSHOT.jar Bla 2" on Java 8 and Java 11

      Show
      Deploy buggywar.war to wildfly running on Java 11 Open http://localhost:8080/buggywar/Bla The text should be "BlaBla(joined with Java 11)" but is "BlaBla(joined with Java 8)" You can verify the working multi-release-JAR by running "java -jar multireleaselib-0.0.1-SNAPSHOT.jar Bla 2" on Java 8 and Java 11
    • 53300848

      1
      down vote
      favorite

      Since Java 9 there are Multi-Release JARs (MRJARS) that allow different classes for different Java versions to be included in one JAR file. I was surprised when a Wildfly 14 running on Java 11 executed Java-8-code in a JAR included in a WAR although the JAR was a MRJAR with code for Java 11. That JAR included as a dependency for a regular Java SE project is running different code depending on the running JRE, but when included in a WAR, the Java-11-code seems to be ignored.

      Is that expected behavior for a webserver, as Java EE 8 does not explicitly require Java 9 (which introduced MRJARs) but only Java 8?

        1. multireleaselib-0.0.1-SNAPSHOT.jar
          5 kB
        2. multireleaselib-0.0.1-SNAPSHOT.jar
          7 kB
        3. multireleaselib.src.zip
          6 kB
        4. multireleaselib.src.zip
          7 kB
        5. buggywar.war
          8 kB
        6. buggywar.src.zip
          3 kB

              dlloyd@redhat.com David Lloyd
              hd42_jira Daniel Schwering (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: