使用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一起运行?
最佳答案
Payara Micro 5.182不支持JDK9 +,仅支持JDK8。预计在今年最后一个季度对JDK11的支持为5.184。
关于java - payara micro 5.182未部署使用java10编译的Web应用程序,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51312374/