I’m trying to use Java Modules in my Spring Boot project and I’m getting the following exception:
java.lang.module.ResolutionException: Modules jsr305 and java.annotation export package javax.annotation to module org.jvnet.staxex
How can I solve this problem?
Advertisement
Answer
Try using JDK8 to run this code. It seems to be a compatability issue
Edit:
The root cause is that this package has been removed. (https://jcp.org/en/jsr/detail?id=305) from the standard JVM installation after java 8.
Some of the dependencies in your code depends on it, therefore, there is a launch probelem. It comes from this dependency org.jvnet.staxex
. Its used for XML parsing. Swapping it out for another package, which does not have this dependency is likely to be time consuming if you have a large XML-related code base.
What might work is trying to manually add the dependency which provides these classes. Try adding this to your dependencies
Also, this blog post might help