gpt4 book ai didi

java - payara micro 5.182 不部署用 java10 编译的 Web 应用程序

转载 作者:行者123 更新时间:2023-11-30 06:06:05 24 4
gpt4 key购买 nike

使用 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。预计今年最后一个季度 5.184 版本将支持 JDK11。

关于java - payara micro 5.182 不部署用 java10 编译的 Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51312374/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com