1

I am facing the same problem as many people did in the past. Can't build the spring boot application because i am getting the Exception which is mentioned in the title. Precisely it looks like this:

Error:java: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

I know that there was a topic about this before i have posted mine but none of the provided solutions helped me. Simply i am literally out of ideas. All i have wanted is to generate back-end and front-end with jhipster.I didnt even write one single line of code yet.

Let's mention that the project is Java 8 and that i tried to solve this by adding some dependencies as its mentioned in the similar topic which is here How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9

I have added this in my pom file becasue i use maven but the exception still occurs

 <dependency>
     <groupId>javax.xml.bind</groupId>
     <artifactId>jaxb-api</artifactId>
     <version>2.3.0</version>
 </dependency>

Then i try to solve by adding this becasue its labeled as proper long term solution for all jdk versions

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2.11</version>
</dependency>

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.2.11</version>
</dependency>

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.2.11</version>
</dependency>

<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1.1</version>
</dependency>

Any help or advice would be appreciated. Thanks in advance

Milos
  • 394
  • 2
  • 19

1 Answers1

3

Probably there is some problem either in your project configuration or in IntelliJ's Java Compiler settings.

Make sure that Java Compiler is set to 'Same as language level' or set it manually to desired version.

Image 1

Make sure that all of the following project settings are set to Java 8:

Image 2

Image 3

Make sure modules are set to correct version as well:

Image 4

FilipRistic
  • 2,661
  • 4
  • 22
  • 31
  • Yeah, when i checked the compiler version it was placed to Java 8 version but when I compare compiler java version with the project sdk version, they were not the same. Project version was Java 11 and that's why spring boot wont build. – Milos Jan 25 '19 at 15:20