Which app-servers support multi-release JARs in WARs (if any)?










1















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? Are there other webservers that do correctly read the MRJARs when run on a newer Java version? Or are MRJARs just a feature for Java SE?



If I understand the Wildfly documentation correctly, all contents of a WAR a loaded by the same class loader (org.jboss.modules.ModuleClassLoader according to my debugger), so maybe that classloader does not correclty read the included JARs?










share|improve this question



















  • 1





    Running with -Djdk.util.jar.enableMultiRelease=force might be useful for your testing.

    – Alan Bateman
    Nov 14 '18 at 13:39






  • 1





    That argument does not seem to have any influence on my wildfly, @AlanBateman.

    – hd42
    Nov 14 '18 at 13:52






  • 1





    This would work for installed modules, but it doesn't look like it works for libraries in a WAR. It could have to do with the WAR not having the MR JAR spec. Feel free to file an issue at issues.jboss.org/browse/WFLY though.

    – James R. Perkins
    Nov 15 '18 at 3:56






  • 1





    To clarify a bit I think it has to do with libraries being loaded in the same CL as the WAR.

    – James R. Perkins
    Nov 15 '18 at 3:57











  • I opened issues.jboss.org/browse/WFLY-11353, @JamesR.Perkins

    – hd42
    Nov 15 '18 at 8:03
















1















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? Are there other webservers that do correctly read the MRJARs when run on a newer Java version? Or are MRJARs just a feature for Java SE?



If I understand the Wildfly documentation correctly, all contents of a WAR a loaded by the same class loader (org.jboss.modules.ModuleClassLoader according to my debugger), so maybe that classloader does not correclty read the included JARs?










share|improve this question



















  • 1





    Running with -Djdk.util.jar.enableMultiRelease=force might be useful for your testing.

    – Alan Bateman
    Nov 14 '18 at 13:39






  • 1





    That argument does not seem to have any influence on my wildfly, @AlanBateman.

    – hd42
    Nov 14 '18 at 13:52






  • 1





    This would work for installed modules, but it doesn't look like it works for libraries in a WAR. It could have to do with the WAR not having the MR JAR spec. Feel free to file an issue at issues.jboss.org/browse/WFLY though.

    – James R. Perkins
    Nov 15 '18 at 3:56






  • 1





    To clarify a bit I think it has to do with libraries being loaded in the same CL as the WAR.

    – James R. Perkins
    Nov 15 '18 at 3:57











  • I opened issues.jboss.org/browse/WFLY-11353, @JamesR.Perkins

    – hd42
    Nov 15 '18 at 8:03














1












1








1








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? Are there other webservers that do correctly read the MRJARs when run on a newer Java version? Or are MRJARs just a feature for Java SE?



If I understand the Wildfly documentation correctly, all contents of a WAR a loaded by the same class loader (org.jboss.modules.ModuleClassLoader according to my debugger), so maybe that classloader does not correclty read the included JARs?










share|improve this question
















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? Are there other webservers that do correctly read the MRJARs when run on a newer Java version? Or are MRJARs just a feature for Java SE?



If I understand the Wildfly documentation correctly, all contents of a WAR a loaded by the same class loader (org.jboss.modules.ModuleClassLoader according to my debugger), so maybe that classloader does not correclty read the included JARs?







java wildfly war java-9 java-ee-8






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 13:57







hd42

















asked Nov 14 '18 at 12:59









hd42hd42

1,1751218




1,1751218







  • 1





    Running with -Djdk.util.jar.enableMultiRelease=force might be useful for your testing.

    – Alan Bateman
    Nov 14 '18 at 13:39






  • 1





    That argument does not seem to have any influence on my wildfly, @AlanBateman.

    – hd42
    Nov 14 '18 at 13:52






  • 1





    This would work for installed modules, but it doesn't look like it works for libraries in a WAR. It could have to do with the WAR not having the MR JAR spec. Feel free to file an issue at issues.jboss.org/browse/WFLY though.

    – James R. Perkins
    Nov 15 '18 at 3:56






  • 1





    To clarify a bit I think it has to do with libraries being loaded in the same CL as the WAR.

    – James R. Perkins
    Nov 15 '18 at 3:57











  • I opened issues.jboss.org/browse/WFLY-11353, @JamesR.Perkins

    – hd42
    Nov 15 '18 at 8:03













  • 1





    Running with -Djdk.util.jar.enableMultiRelease=force might be useful for your testing.

    – Alan Bateman
    Nov 14 '18 at 13:39






  • 1





    That argument does not seem to have any influence on my wildfly, @AlanBateman.

    – hd42
    Nov 14 '18 at 13:52






  • 1





    This would work for installed modules, but it doesn't look like it works for libraries in a WAR. It could have to do with the WAR not having the MR JAR spec. Feel free to file an issue at issues.jboss.org/browse/WFLY though.

    – James R. Perkins
    Nov 15 '18 at 3:56






  • 1





    To clarify a bit I think it has to do with libraries being loaded in the same CL as the WAR.

    – James R. Perkins
    Nov 15 '18 at 3:57











  • I opened issues.jboss.org/browse/WFLY-11353, @JamesR.Perkins

    – hd42
    Nov 15 '18 at 8:03








1




1





Running with -Djdk.util.jar.enableMultiRelease=force might be useful for your testing.

– Alan Bateman
Nov 14 '18 at 13:39





Running with -Djdk.util.jar.enableMultiRelease=force might be useful for your testing.

– Alan Bateman
Nov 14 '18 at 13:39




1




1





That argument does not seem to have any influence on my wildfly, @AlanBateman.

– hd42
Nov 14 '18 at 13:52





That argument does not seem to have any influence on my wildfly, @AlanBateman.

– hd42
Nov 14 '18 at 13:52




1




1





This would work for installed modules, but it doesn't look like it works for libraries in a WAR. It could have to do with the WAR not having the MR JAR spec. Feel free to file an issue at issues.jboss.org/browse/WFLY though.

– James R. Perkins
Nov 15 '18 at 3:56





This would work for installed modules, but it doesn't look like it works for libraries in a WAR. It could have to do with the WAR not having the MR JAR spec. Feel free to file an issue at issues.jboss.org/browse/WFLY though.

– James R. Perkins
Nov 15 '18 at 3:56




1




1





To clarify a bit I think it has to do with libraries being loaded in the same CL as the WAR.

– James R. Perkins
Nov 15 '18 at 3:57





To clarify a bit I think it has to do with libraries being loaded in the same CL as the WAR.

– James R. Perkins
Nov 15 '18 at 3:57













I opened issues.jboss.org/browse/WFLY-11353, @JamesR.Perkins

– hd42
Nov 15 '18 at 8:03






I opened issues.jboss.org/browse/WFLY-11353, @JamesR.Perkins

– hd42
Nov 15 '18 at 8:03













1 Answer
1






active

oldest

votes


















0














Well, my Bug report lead to a fix so now Wildfly does support MRJARs in deployed WARs :)






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53300848%2fwhich-app-servers-support-multi-release-jars-in-wars-if-any%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Well, my Bug report lead to a fix so now Wildfly does support MRJARs in deployed WARs :)






    share|improve this answer



























      0














      Well, my Bug report lead to a fix so now Wildfly does support MRJARs in deployed WARs :)






      share|improve this answer

























        0












        0








        0







        Well, my Bug report lead to a fix so now Wildfly does support MRJARs in deployed WARs :)






        share|improve this answer













        Well, my Bug report lead to a fix so now Wildfly does support MRJARs in deployed WARs :)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 8 at 16:28









        hd42hd42

        1,1751218




        1,1751218





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53300848%2fwhich-app-servers-support-multi-release-jars-in-wars-if-any%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo