[jboss-jira] [JBoss JIRA] (WFLY-11353) Classes for newer versions are not loaded from Multi-Release-JARs in WARs
jaikiran pai (Jira)
issues at jboss.org
Sun Jan 6 01:12:00 EST 2019
[ https://issues.jboss.org/browse/WFLY-11353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13678579#comment-13678579 ]
jaikiran pai commented on WFLY-11353:
-------------------------------------
Another potential workaround probably would be to rely on the JRE's system properties. As noted in the javadoc of {{JarFile}} https://docs.oracle.com/javase/9/docs/api/java/util/jar/JarFile.html it can help in cases like these:
{quote}
Implementation Note:
If the API can not be used to configure a JarFile (e.g. to override the configuration of a compiled application or library), two System properties are available.
jdk.util.jar.version can be assigned a value that is the String representation of a non-negative integer <= Runtime.version().major(). The value is used to set the effective runtime version to something other than the default value obtained by evaluating Runtime.version().major(). The effective runtime version is the version that the JarFile(File, boolean, int, Runtime.Version) constructor uses when the value of the last argument is JarFile.runtimeVersion().
jdk.util.jar.enableMultiRelease can be assigned one of the three String values true, false, or force. The value true, the default value, enables multi-release jar file processing. The value false disables multi-release jar processing, ignoring the "Multi-Release" manifest attribute, and the versioned directories in a multi-release jar file if they exist. Furthermore, the method isMultiRelease() returns false. The value force causes the JarFile to be initialized to runtime versioning after construction. It effectively does the same as this code: (new JarFile(File, boolean, int, JarFile.runtimeVersion()).
{quote}
You can try starting WildFly server by setting those system property.
> Classes for newer versions are not loaded from Multi-Release-JARs in WARs
> -------------------------------------------------------------------------
>
> Key: WFLY-11353
> URL: https://issues.jboss.org/browse/WFLY-11353
> Project: WildFly
> Issue Type: Bug
> Components: Class Loading
> Affects Versions: 14.0.0.Final, 15.0.0.Final
> Environment: Java 9+
> Reporter: Daniel Schwering
> Priority: Major
> Attachments: buggywar.src.zip, buggywar.war, multireleaselib-0.0.1-SNAPSHOT.jar, multireleaselib-0.0.1-SNAPSHOT.jar, multireleaselib.src.zip, multireleaselib.src.zip
>
>
> 1
> down vote
> favorite
> Since Java 9 there are Multi-Release JARs ([MRJARS|https://openjdk.java.net/jeps/238]) 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?
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list