Our company forced me to change to newer Intellij Idea version 2023.1 but I encounter error whenever I build our project in it (using the hammer icon or Build->Build Project, or whenever Intellij runs build automatically):
java: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException javax.xml.bind.JAXBException
I have set up (consider the fact it worked in previous Idea 2022 without changing the project pom or other project related things):
- java 8u201
- apache maven 3.8.5
- environmental variables %JAVA_HOME%, %MAVEN_HOME% and their /bin versions in Path are set
Intellij Idea important settings:
Project Settings -> Project: SDK: 8u201 (which is defined as its %JAVA_HOME% path in PlatformSettings->SDKs)
Settings -> Build, Execution, Deployment -> Build Tools -> Maven: Maven home path: %MAVEN_HOME%
Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Importing: VM options for importer: -Xmx768m, JDK: project JDK
I expect there is error in Intellij settings or somewhere around Intellij specifically.
I tried building project in terminal using mvn clean install
and that works but it is not helpful. I need to run JUnit tests in Intellij which automatically make Intellij build which ends up with error. So that’s why I need the build to work.
I tried all three of the magic buttons in the right maven tab in Intellij.
I tried using VM option -XX:+IgnoreUnrecognizedVMOptions
from this stack overflow thread:
How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
I tried to remove all caches from %LOCALAPPDATA%JetBrains
I tried Invalidate caches and restart Intellij (checking all relevant checkboxes)
I tried switching JDK from oracle to amazon
I tried switching maven 3.8.5 to 3.9.6
Jaroslav Stepan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.