diff --git a/nucleus/common/common-util/src/main/java/com/sun/enterprise/loader/ASURLClassLoader.java b/nucleus/common/common-util/src/main/java/com/sun/enterprise/loader/ASURLClassLoader.java index 53fa2758fba..2afc4f1a306 100644 --- a/nucleus/common/common-util/src/main/java/com/sun/enterprise/loader/ASURLClassLoader.java +++ b/nucleus/common/common-util/src/main/java/com/sun/enterprise/loader/ASURLClassLoader.java @@ -621,8 +621,20 @@ private byte[] loadClassData0(final URLEntry res, final String entryName) { res.setProtectionDomain(ASURLClassLoader.this, entry.getCertificates()); return classData; } + + if (zip.isMultiRelease()) { + String javaVersion = System.getProperty("java.version"); + JarEntry multiVersionEntry = zip.getJarEntry("META-INF/versions/"+javaVersion+"/"+entryName); + if (multiVersionEntry != null) { + InputStream classStream = zip.getInputStream(multiVersionEntry); + byte[] classData = getClassData(classStream); + res.setProtectionDomain(ASURLClassLoader.this, multiVersionEntry.getCertificates()); + return classData; + } + } } else { // Its a directory.... - File classFile = new File (res.file, entryName.replace('/', File.separatorChar)); + String entryPath = entryName.replace('/', File.separatorChar); + File classFile = new File (res.file, entryPath); if (classFile.exists()) { try (InputStream classStream = new FileInputStream(classFile)) { byte[] classData = getClassData(classStream); @@ -630,6 +642,18 @@ private byte[] loadClassData0(final URLEntry res, final String entryName) { return classData; } } + + File multiVersionDir = new File(res.file, "META-INF/versions/"); + if (multiVersionDir.exists()) { + File multiVersionClassFile = new File(multiVersionDir, entryPath); + if (multiVersionClassFile.exists()) { + try (InputStream classStream = new FileInputStream(multiVersionClassFile)) { + byte[] classData = getClassData(classStream); + res.setProtectionDomain(ASURLClassLoader.this, null); + return classData; + } + } + } } } catch (IOException ioe) { _logger.log(Level.INFO, CULoggerInfo.exceptionInASURLClassLoader, ioe);