Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix NoSuchFieldError 'com.sun.tools.javac.tree.JCTree

How can i fix 'java: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'' error?

When I research the problem, I encountered Java version and lombok version incompatibility problem. I use java 19 and lombok 1.18.20 version in my spring boot project. How can I fix this problem without using jdk21?

like image 479
Bktedr Avatar asked Sep 09 '25 19:09

Bktedr


2 Answers

This issue is only related to incompatibility between Project SDK, Spring Boot and Lombok versions. These two pairs of old and new versions work well together. Note to check the "Project Structure" to make sure the correct SDK is set for the project. Check out the screenshot below each sample for more clarity.

  • Old versions
    • JDK 1.8
    • Spring Boot 2.7.2
    • Lombok 1.18.20

compatible old versions

  • New versions
    • JDK 21
    • Spring Boot 3.2.4
    • Lombok 1.18.30 compatible new versions
like image 124
Javad Mahdioun Avatar answered Sep 12 '25 08:09

Javad Mahdioun


You can try to modify lombok's version, update (exactly).

Usually the newest version will be OK. As follows.

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.34</version>
</dependency>
like image 31
JinghuaOriental Avatar answered Sep 12 '25 07:09

JinghuaOriental