使用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一起运行?
答案 0 :(得分:1)
Payara Micro 5.182不支持JDK9 +,仅支持JDK8。预计在今年最后一个季度为5.184提供JDK11支持。