Problems with entity enhancement

I get below error message when try to execute JAR

Jmix version: 2.4.1
IntelliJ version: 2024.3.1.1 (Community Version)

Error:
Entity class User is missing some of enhancing interfaces:PersistenceObject,PersistenceWeaved,PersistenceWeavedFetchGroups

Thanks in advance.

Hi @lee.seakfei

Please provide the full log of the starting application.

Regards,
Konstantin

Hi @krivopustov

Where can I get the full log of the starting application?

Hi @krivopustov, this is the log file.

idea.log.txt (89.9 KB)

Regards

idea.log is helpful when a problem is inside Studio.
But you said that you are trying to execute JAR, so perhaps you are doing it in the terminal.
Copy the whole console output from the moment you launched the command.

console output.txt (32.6 KB)

The following line tells that Java 23 can cause problems:
2025-01-02T08:56:58.558+08:00 WARN 8248 --- [ main] eclipselink.logging.all : Java SE '23' is not fully supported yet

Jmix 2.4 officially supports Java 17 and Java 21, see Setup :: Jmix Documentation

Also, check that the Task entity is located inside com.company.projectmanagement package, usually in the entities sub-package.

If it doesn’t help, attach the whole entity class and build.gradle file here.

When I run this command, it return error ./gradlew “-Pvaadin.productionMode=true” bootJar
Starting a Gradle Daemon (subsequent builds will be faster)

Task :compileJava
Enhancing entities in root project ‘projectmanagement’ for source set ‘main’
Project entities:
JPA: [com.company.projectmanagement.entity.User, com.company.projectmanagement.entity.Project, com.company.projectmanagement.entity.Task, com.company.projectmanagement.entity.TimeEntry];
DTO: [];
Project converters: [].
Running EclipseLink enhancer in root project ‘projectmanagement’ for source set ‘main’
[EL Warning]: 2025-01-03 16:13:55.671–Java SE ‘23’ is not fully supported yet. Report this error to the EclipseLink open source project. (There is no English translation for this message.)
[EL Warning]: weaver: 2025-01-03 16:13:55.804–Weaver encountered an exception while trying to weave class com/company/projectmanagement/entity/Project. The exception was: Unsupported class file major version 67
[EL Warning]: weaver: 2025-01-03 16:13:55.807–Weaver encountered an exception while trying to weave class com/company/projectmanagement/entity/Task. The exception was: Unsupported class file major version 67
[EL Warning]: weaver: 2025-01-03 16:13:55.811–Weaver encountered an exception while trying to weave class com/company/projectmanagement/entity/TimeEntry. The exception was: Unsupported class file major version 67
[EL Warning]: weaver: 2025-01-03 16:13:55.818–Weaver encountered an exception while trying to weave class com/company/projectmanagement/entity/User. The exception was: Unsupported class file major version 67
Running Jmix enhancer in root project ‘projectmanagement’ for source set ‘main’

BUILD SUCCESSFUL in 55s
8 actionable tasks: 7 executed, 1 up-to-date

image

jmix(task).txt (2.9 KB)
jmix(build.gradle).txt (1.8 KB)

Thanks, your code is correct.
The culprit is obviously Java 23 which you are using to build the app:

[EL Warning]: weaver: 2025-01-03 16:13:55.804–Weaver encountered an exception while trying to weave class com/company/projectmanagement/entity/Project. The exception was: Unsupported class file major version 67

Class version 67 is produced by Java 23.

You should remove Java 23 and install JDK 21 as described in Setup :: Jmix Documentation.

The screenshot you provided shows that you are using the correct Java 21 in the IDE. But when you invoke commands in the terminal, you are working with Java 23.

after I remove the Java 23, it works now but I get below error when I run this command
C:\Users\seikfei.jdks\liberica-full-21.0.5\bin\java -jar projectmanagement-0.0.1.jar

Exception in thread “main” java.lang.UnsupportedClassVersionError: com/company/projectmanagement/ProjectmanagementApplication has been compiled by a more recent version of the Java Runtime (class file version 67.0), this version of the Java Runtime only recognizes class file versions up to 65.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:107)
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:534)
at java.base/java.lang.Class.forName(Class.java:513)
at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:99)
at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:64)
at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:40)

You need to rebuild the JAR with Java 21.

May I know how to change from Java 23 to Java 21? I change from Project Structure but still using Java 23 to build the JAR.

Uninstall Java 23 (I believe there is some information about it on the internet, depending on your OS), then install Java 21.