可以从Payara-Micro-Maven-Plugin启动Pareara Micro,获得“无支持的JDK”
我整理了一个示例项目,以演示我遇到的问题。
https://github.com/johnmanko/johnmanko/payara-payara-micro-plugin-plugin-glugin-group
基本上,我正在尝试在开发过程中通过Payara Micro的Maven插件启动我的应用程序。这是pom.xml
config:
<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-micro-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<useUberJar>false</useUberJar>
<contextRoot>/myapp</contextRoot>
<payaraVersion>${version.payara}</payaraVersion>
<deployWar>false</deployWar>
<artifactItem>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-micro</artifactId>
<version>${version.payara.micro}</version>
</artifactItem>
<javaCommandLineOptions>
<option>
<value>-Xdebug</value>
</option>
</javaCommandLineOptions>
<commandLineOptions>
<option>
<key>--autoBindHttp</key>
</option>
<option>
<key>--nocluster</key>
</option>
<option>
<key>--port</key>
<value>8095</value>
</option>
<option>
<key>--prebootcommandfile</key>
<value>${project.basedir}/src/main/resources/pre-boot-commands.txt</value>
</option>
<option>
<key>--postbootcommandfile</key>
<value>${project.basedir}/src/main/resources/post-boot-commands.txt</value>
</option>
<option>
<key>--deploy</key>
<value>${project.build.directory}/${project.build.finalName}</value>
</option>
</commandLineOptions>
</configuration>
</plugin>
结果:结果是:
[2022-05-11T09:54:58.362-0400] [] [SEVERE] [] [org.eclipse.persistence.session./file:/path/to/payara-micro-plugin-group/payara-micro-plugin-example/target/payara-micro-plugin-example-1.0.0-SNAPSHOT/WEB-INF/classes/_MyAppPU.metadata] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1652277298362] [levelValue: 1000] [[
The java.lang.Object class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.ArrayIndexOutOfBoundsException: Index 8 out of bounds for length 0
at org.eclipse.persistence.internal.libraries.asm.ClassReader.readUnsignedShort(ClassReader.java:3573)
[2022-05-11T09:54:58.364-0400] [] [WARNING] [] [org.eclipse.persistence.session./file:/path/to/payara-micro-plugin-group/payara-micro-plugin-example/target/payara-micro-plugin-example-1.0.0-SNAPSHOT/WEB-INF/classes/_MyAppPU.metadata] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1652277298364] [levelValue: 900] [[
The java.lang.String class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 62
at org.eclipse.persistence.internal.libraries.asm.ClassReader.<init>(ClassReader.java:196)
[2022-05-11T09:54:58.372-0400] [] [WARNING] [] [org.eclipse.persistence.session./file:/path/to/payara-micro-plugin-group/payara-micro-plugin-example/target/payara-micro-plugin-example-1.0.0-SNAPSHOT/WEB-INF/classes/_MyAppPU.metadata] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1652277298372] [levelValue: 900] [[
The java.lang.Long class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 62
at org.eclipse.persistence.internal.libraries.asm.ClassReader.<init>(ClassReader.java:196)
[2022-05-11T09:54:58.379-0400] [] [WARNING] [] [org.eclipse.persistence.session./file:/path/to/payara-micro-plugin-group/payara-micro-plugin-example/target/payara-micro-plugin-example-1.0.0-SNAPSHOT/WEB-INF/classes/_MyAppPU.metadata] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1652277298379] [levelValue: 900] [[
The java.lang.Number class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 62
at org.eclipse.persistence.internal.libraries.asm.ClassReader.<init>(ClassReader.java:196)
该项目是用JDK 1.8构建的,MAVEN的开始是将JAVA_HOME设置为JDK 1.8:
DATABASE_USER=user \
DATABASE_PASS=password \
DATABASE_NAME=MY_DB_NAME \
DATABASE_SERVER=localhost \
DATABASE_SERVER_PORT=1234 \
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 \
M2_HOME=/usr/share/maven \
/usr/share/maven/bin/mvn payara-micro:start
系统默认值为Java 18,但我DON t看看这甚至可以发挥作用。所有包含的应用程序依赖项均使用JDK 1.8或更早(我检查了每个)。
为什么要拿起主要版本62?
I put together a sample project to demonstrate the issue I'm having.
https://github.com/johnmanko/payara-micro-plugin-group
Basically, I'm trying to launch my app via payara micro's maven plugin during development. Here is the pom.xml
config:
<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-micro-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<useUberJar>false</useUberJar>
<contextRoot>/myapp</contextRoot>
<payaraVersion>${version.payara}</payaraVersion>
<deployWar>false</deployWar>
<artifactItem>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-micro</artifactId>
<version>${version.payara.micro}</version>
</artifactItem>
<javaCommandLineOptions>
<option>
<value>-Xdebug</value>
</option>
</javaCommandLineOptions>
<commandLineOptions>
<option>
<key>--autoBindHttp</key>
</option>
<option>
<key>--nocluster</key>
</option>
<option>
<key>--port</key>
<value>8095</value>
</option>
<option>
<key>--prebootcommandfile</key>
<value>${project.basedir}/src/main/resources/pre-boot-commands.txt</value>
</option>
<option>
<key>--postbootcommandfile</key>
<value>${project.basedir}/src/main/resources/post-boot-commands.txt</value>
</option>
<option>
<key>--deploy</key>
<value>${project.build.directory}/${project.build.finalName}</value>
</option>
</commandLineOptions>
</configuration>
</plugin>
The result is the following:
[2022-05-11T09:54:58.362-0400] [] [SEVERE] [] [org.eclipse.persistence.session./file:/path/to/payara-micro-plugin-group/payara-micro-plugin-example/target/payara-micro-plugin-example-1.0.0-SNAPSHOT/WEB-INF/classes/_MyAppPU.metadata] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1652277298362] [levelValue: 1000] [[
The java.lang.Object class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.ArrayIndexOutOfBoundsException: Index 8 out of bounds for length 0
at org.eclipse.persistence.internal.libraries.asm.ClassReader.readUnsignedShort(ClassReader.java:3573)
[2022-05-11T09:54:58.364-0400] [] [WARNING] [] [org.eclipse.persistence.session./file:/path/to/payara-micro-plugin-group/payara-micro-plugin-example/target/payara-micro-plugin-example-1.0.0-SNAPSHOT/WEB-INF/classes/_MyAppPU.metadata] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1652277298364] [levelValue: 900] [[
The java.lang.String class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 62
at org.eclipse.persistence.internal.libraries.asm.ClassReader.<init>(ClassReader.java:196)
[2022-05-11T09:54:58.372-0400] [] [WARNING] [] [org.eclipse.persistence.session./file:/path/to/payara-micro-plugin-group/payara-micro-plugin-example/target/payara-micro-plugin-example-1.0.0-SNAPSHOT/WEB-INF/classes/_MyAppPU.metadata] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1652277298372] [levelValue: 900] [[
The java.lang.Long class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 62
at org.eclipse.persistence.internal.libraries.asm.ClassReader.<init>(ClassReader.java:196)
[2022-05-11T09:54:58.379-0400] [] [WARNING] [] [org.eclipse.persistence.session./file:/path/to/payara-micro-plugin-group/payara-micro-plugin-example/target/payara-micro-plugin-example-1.0.0-SNAPSHOT/WEB-INF/classes/_MyAppPU.metadata] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1652277298379] [levelValue: 900] [[
The java.lang.Number class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 62
at org.eclipse.persistence.internal.libraries.asm.ClassReader.<init>(ClassReader.java:196)
The project is built with JDK 1.8, and maven is started with setting JAVA_HOME to JDK 1.8:
DATABASE_USER=user \
DATABASE_PASS=password \
DATABASE_NAME=MY_DB_NAME \
DATABASE_SERVER=localhost \
DATABASE_SERVER_PORT=1234 \
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 \
M2_HOME=/usr/share/maven \
/usr/share/maven/bin/mvn payara-micro:start
The system default is Java 18, but I don't see how that can even come into play. All included application dependencies were compiled with JDK 1.8 or earlier (I checked each one).
Why would it be picking up major version 62?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了原因。该插件使用 apache工具链/code>,它发现错误的一个(即系统一个)。
一种解决方案是添加插件
&lt; javapath&gt;
选项:当然,这对Mac Windows等其他系统上的开发人员不起作用。
适当的方法是配置
〜/.m2/toolchains.xml
文件并设置工具链在POM中使用它。〜/.m2/toolchains.xml
:pom.xml
使用
nbactions.xml
:使用commandline启动:
I found the cause. The plugin uses Apache Toolchain to locate
java
, and it's finding the wrong one (ie, the system one).One solution is to add the plugin
<javaPath>
option:Of course, that won't work for devs on other systems like Windows of Mac.
The proper way is configure a
~/.m2/toolchains.xml
file and set up Toolchain in the pom to use that.~/.m2/toolchains.xml
:pom.xml
Launch using
nbactions.xml
:Launch using commandline: