当使用 Java10 启动 payara 5.182 时,它会抛出以下 IllegalArgumentException
[java] Exception while visiting WEB-INF/classes/com/Service.class of size 1163
[java] java.lang.IllegalArgumentException
[java] at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.<init>(ClassReader.java:160)
[java] at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.<init>(ClassReader.java:143)
[java] at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.<init>(ClassReader.java:418)
[java] at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:359)
[java] at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:165)
[java] at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:127)
[java] at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:345)
[java] at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:68)
[java] at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:304)
[java] at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:293)
[java] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[java] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
[java] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[java] at java.base/java.lang.Thread.run(Thread.java:844)
[java] ]]
我认为它是由重新打包的 asm 类 ClassReader 引起的(我认为它是 asm 版本 6.0)
public ClassReader(final byte[] b, final int off, final int len) {
this.b = b;
// checks the class version
if (readShort(off + 6) > Opcodes.V9) {
throw new IllegalArgumentException();
}
...
}
在 asm 版本 6.2 中,ClassReader 类似乎与 Java11 兼容
ClassReader(
final byte[] classFileBuffer, final int classFileOffset, final boolean checkClassVersion) {
this.b = classFileBuffer;
// Check the class' major_version. This field is after the magic and minor_version fields, which
// use 4 and 2 bytes respectively.
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V11) {
throw new IllegalArgumentException(
"Unsupported class file major version " + readShort(classFileOffset + 6));
}
...
}
问题是,我怎样才能让 payara 5.182 与 Java10 一起运行?