If you've recently upgraded your Spring Boot project to JDK 21 and encountered the error message "java.lang.NoSuchFieldError: JCImport does not have member field JCTree qualid", you're not alone. This error is caused by a compatibility issue between Lombok and JDK 21.
In this tutorial, you will know how to resolve this issue so that you can run your app again.
What's the problem?
Lombok is a popular Java library that helps developers reduce boilerplate code by generating annotations that automatically generate getters, setters, constructors, and other methods. However, Lombok's compatibility with JDK 21 is not yet fully established.
How to fix the error
To resolve this error, you need to update your Lombok dependency to version 1.18.30 or higher. This version is specifically compatible with JDK 21.
Here are two possible ways to update your Lombok dependency:
It's generally recommended to update your Lombok dependency to version 1.18.30 or higher. This will ensure that you have the latest and most stable version of Lombok, and it will also resolve the compatibility issue with JDK 21.
By following one of the two methods outlined above, you can easily fix the "java.lang.NoSuchFieldError: JCImport does not have member field JCTree qualid" error and continue developing your Spring Boot project using JDK 21.
I hope you enjoyed reading this, and I'm curious to hear if this tutorial helped you. Please let me know your thoughts below in the comments. Don't forget to subscribe to my newsletter to avoid missing my upcoming blog posts.