当前位置: 首页 > 知识库问答 >
问题:

Intellij Maven java。lang.IllegalArgumentException:不支持的类文件主版本61和实体是使用不受支持的JDK编译的

关胜
2023-03-14

我试图开发一个带有数据库的应用程序,但我遇到了很多错误,比如java。lang.IllegalArgumentException:不支持的类文件主版本61和[EL Severe]:元数据:2022-01-26 17:43:20.982--服务器会话(422250493)--数据库。模型StageEntity类是用不受支持的JDK编译的。向EclipseLink开源项目报告此错误。对于通过映射创建的每个实体。这是一个Maven项目,所以我没有找到任何关于它的信息,只有gradle。我在java 17(17.0.2)上工作,一般来说我不熟悉intellij或java,希望有人能为我的问题找到答案。这是我的坚持。xml文件

<?xml version="1.0" encoding="UTF-8"?>
<persistence-unit name="PersistenceMIP">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

    <class>database.model.StageEntity</class>
    <class>database.model.StageTeamEntity</class>
    <class>database.model.TeamEntity</class>
    <class>database.model.UserEntity</class>
    <properties>
        <property name="eclipselink.jdbc.url" value="jdbc:postgresql://localhost:5432/MIP"/>
        <property name="eclipselink.jdbc.driver" value="org.postgresql.Driver"/>
        <property name="eclipselink.jdbc.user" value="postgres"/>
        <property name="eclipselink.jdbc.password" value="root"/>
    </properties>
</persistence-unit>

这是我的pom。xml文件

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>MIP1</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <maven.compiler.source>17.0.2</maven.compiler.source>
    <maven.compiler.target>17.0.2</maven.compiler.target>
</properties> <dependencies>

<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-controls</artifactId>
    <version>17.0.1</version>
</dependency>
<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-fxml</artifactId>
    <version>17.0.1</version>
</dependency>


<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>eclipselink</artifactId>
    <version>2.7.7</version>
</dependency>

<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>javax.persistence</artifactId>
    <version>2.2.1</version>
</dependency>


<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>42.2.2</version>
</dependency>

这是我所有警告和错误的一个亮点

  enter code here[EL Info]: transaction: 2022-01-26 17:43:20.954--ServerSession(422250493)--property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
[EL Info]: transaction: 2022-01-26 17:43:20.959--ServerSession(422250493)--property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
[EL Info]: transaction: 2022-01-26 17:43:20.96--ServerSession(422250493)--property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
[EL Info]: transaction: 2022-01-26 17:43:20.96--ServerSession(422250493)--property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
[EL Severe]: metadata: 2022-01-26 17:43:20.982--ServerSession(422250493)--The database.model.StageEntity class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 61
[EL Severe]: metadata: 2022-01-26 17:43:20.984--ServerSession(422250493)--The database.model.StageEntity 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
[EL Severe]: metadata: 2022-01-26 17:43:20.984--ServerSession(422250493)--The database.model.StageTeamEntity class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 61
[EL Severe]: metadata: 2022-01-26 17:43:20.985--ServerSession(422250493)--The database.model.StageTeamEntity 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
[EL Severe]: metadata: 2022-01-26 17:43:20.985--ServerSession(422250493)--The database.model.TeamEntity class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 61
[EL Severe]: metadata: 2022-01-26 17:43:20.985--ServerSession(422250493)--The database.model.TeamEntity 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
[EL Severe]: metadata: 2022-01-26 17:43:20.985--ServerSession(422250493)--The database.model.UserEntity class was compiled with an unsupported JDK. Report this error to the EclipseLink open source project.
java.lang.IllegalArgumentException: Unsupported class file major version 61
[EL Severe]: metadata: 2022-01-26 17:43:20.986--ServerSession(422250493)--The database.model.UserEntity 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
[EL Info]: transaction: 2022-01-26 17:43:20.993--ServerSession(422250493)--property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
[EL Info]: transaction: 2022-01-26 17:43:20.994--ServerSession(422250493)--property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
[EL Info]: transaction: 2022-01-26 17:43:20.994--ServerSession(422250493)--property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
[EL Info]: transaction: 2022-01-26 17:43:20.994--ServerSession(422250493)--property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
[EL Info]: 2022-01-26 17:43:21.094--ServerSession(422250493)--EclipseLink, version: Eclipse Persistence Services - 2.7.7.v20200504-69f2c2b80d
[EL Warning]: metamodel: 2022-01-26 17:43:21.352--The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units.  Please verify that your entity classes are referenced in persistence.xml using either <class> elements or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element
Transaction error: Object: database.model.UserEntity@248df8 is not a known Entity type.

Process finished with exit code 0

共有1个答案

翟高明
2023-03-14

您提到的问题也可能是由于使用了一个库,该库执行某种代码检查/生成,并且还没有准备好使用这个非常年轻的类文件版本。可能eclipselink是这里的问题。尝试升级到最新版本,如果没有帮助,请回到Java16并完全清理和重建您的项目。

例如,请参阅本说明:更新ECLIPSELINK以支持ASM 9.1 for JAVA 17

 类似资料:
  • 我正在尝试运行一个颤振应用程序,在尝试时出现了这个错误,我所做的是我想在没有android studio的情况下运行颤振应用程序,所以我下载了android SDK和JDK 17,在我运行颤振医生后,它告诉我一切都很好,我尝试运行,它给了我这个错误: 所以我尝试了一个旧版本的JDK,它给了我另一个错误,所以我看到了使用JDK 17运行的第三个解决方案,那就是降级gradle中的gradle。属性,

  • 配置:Java:16 Gradle:7.2 Jacoco:0.8.4 当我将我的项目从openJDK8升级到openJDk16时,我看到以下问题: “原因:java.lang.IllegalArgumentException:不支持的类文件主版本60” 还有以下问题: java.lang.instrument.IllegalClassFormatException:检测sun/security/e

  • 我正在尝试用数据库开发一个应用程序,我遇到了很多错误,例如java.lang.IllegalArgumentException:不支持的类文件主版本61和[EL Severe]:元数据:2022-01-26 17:43:20.982--ServerSession(422250493)--数据库模型。StageEntity类是用不受支持的JDK编译的。将此错误报告给EclipseLink开源项目。对

  • 我将我的Android Studio项目从一台计算机移动到另一台计算机,现在我发现错误: “不支持的类文件主版本61”。 我该怎么解决这个问题?

  • 我正在将我的项目从jdk1.8切换到openjdk 17。代码工作正常,ANT可以生成可执行jar。使用Eclipse IDE。 尝试使用yGuard 3.0.0(通过ant)进行混淆时出现问题。任务是: 输出为: [收缩]错误:不支持的类文件主要版本61[收缩]不支持的类文件主要版本61 我知道61意味着java 17,所以我尝试将工作区符合性更改为“编译器符合性级别”-

  • 嗨,我在构建我的gradle项目时遇到了这个错误,尝试了在这里在线找到的所有内容如何修复IntelliJ IDEA中的“不支持的类文件主要版本60”? 我通过从计算机中删除java 17解决了这个问题。。但是不想删除java 17版本,仍然想编译我的代码