我正在嘗試使用資料庫開發應用程式,但遇到了很多錯誤,例如 java.lang.IllegalArgumentException: Unsupported class file major version 61 and [EL Severe]: metadata: 2022-01-26 17:43:20.982--ServerSession (422250493)--database.model.StageEntity 類是使用不受支持的 JDK 編譯的。將此錯誤報告給 EclipseLink 開源專案。 對于通過映射創建的每個物體。這是一個 Maven 專案,所以我沒有找到任何關于它的資訊,只有 gradle。我在 java 17(17.0.2) 上作業,我一般不熟悉 intellij 或 Java,希望我會有人為我的問題找到答案。這是我的 persistence.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
uj5u.com熱心網友回復:
您提到的問題也可能是由于使用了進行某種代碼檢查/生成的庫,并且還沒有準備好使用這個非常年輕的類檔案版本。可能eclipselink是這里的問題。嘗試升級到最新版本,如果這無濟于事,請回傳 Java 16 并完全清理并重建您的專案。
例如,請參閱此注釋:UPDATE ECLIPSELINK TO SUPPORT ASM 9.1 FOR JAVA 17
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/422994.html
標籤:
