Error:java: java.lang.ExceptionInInitializerError IntelliJ
Asked Answered
C

4

17

Heyo!

I've ran into some troubles when attempting to boot up Intellij (ultimate) with JDK 10.0.1 and "spring-boot-starter-test". If I run the main method, regardless of its content and regardless of if I have any active tests I always receive "Error:java: java.lang.ExceptionInInitializerError" after compile, before run.

Summing up, this causes the error

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

Now I assume this has something to do with spring boot test not being compatible with JDK 10, though I'm prone to ask, any ideas how to solve this?

Update 2 To be clear, this is the ONLY output I receive from Intellij

Information:javac 10.0.1 was used to compile java sources
Information:2018-05-14 21:04 - Compilation completed with 1 error and 0 warnings in 2 s 381 ms
Error:java: java.lang.ExceptionInInitializerError

Build, versions and dependencies here

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.2.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>10</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
Ciaracibber answered 13/5, 2018 at 11:14 Comment(2)
Could you share the logs from the failure? What phase does it fail in and what versions of stated dependency/plugin are you using?Incoherent
It fails when I press run, before any output in the message/console panel. Updated main post with dependencies, builds etc.Ciaracibber
C
34

The problem in your case is - Lambook. Lombok does not currently support JDK10. If you comment the dependency the project compiled without errors (i checked).
And here is a full error stack (if you run mvn compile in console):

`Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags`

Chambless answered 15/5, 2018 at 6:16 Comment(1)
It never occurred to me that mvn compile could give additional information, thanks borinoCiaracibber
H
9

Update Lombok to the newest version. Helped in my case Here is a link with the newest Lombok https://projectlombok.org/download Optionally modify the .pom file in Your project (by changing the name of the lombok version).

Hendiadys answered 3/12, 2018 at 4:3 Comment(0)
T
1

at least lombok version 1.18.12 worked me

Tonedeaf answered 17/4, 2020 at 13:0 Comment(0)
H
0

Add JMockit.Jar location in vm options under configurations as:

javaagent:C:/.../.../jmockit.jar

Highkey answered 31/8, 2021 at 9:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.