Error:java: java.lang.ExceptionInInitializerError com.sun.tools.javac.code.TypeTags when trying to run maven

We Are Going To Discuss About Error:java: java.lang.ExceptionInInitializerError com.sun.tools.javac.code.TypeTags when trying to run maven. So lets Start this Java Article.

Error:java: java.lang.ExceptionInInitializerError com.sun.tools.javac.code.TypeTags when trying to run maven

  1. Error:java: java.lang.ExceptionInInitializerError com.sun.tools.javac.code.TypeTags when trying to run maven

    The real issue is: one of library org.deeplearning4j:deeplearning4j-core:jar:0.9.1:compile this jar having a dependency on org.projectlombok:lombok:jar:1.16.16:compile.

  2. Error:java: java.lang.ExceptionInInitializerError com.sun.tools.javac.code.TypeTags when trying to run maven

    The real issue is: one of library org.deeplearning4j:deeplearning4j-core:jar:0.9.1:compile this jar having a dependency on org.projectlombok:lombok:jar:1.16.16:compile.

Solution 1

This is wrong.

<maven.compiler.source>1.11</maven.compiler.source>
<maven.compiler.target>1.11</maven.compiler.target>

Post Java 1.9, the version naming has changed. Make the following changes in the pom.xml.

<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>

The same convention follows from 10+ Java version.

The real issue is: one of library org.deeplearning4j:deeplearning4j-core:jar:0.9.1:compile this jar having a dependency on org.projectlombok:lombok:jar:1.16.16:compile.

So this was an issue with Lombok which they fixed in a later version. To see all transitive dependencies you can do a mvn dependency:tree and see all transitive dependencies of the libraries you have brought in.

I have included the below dependency in the pom and that resolved the issue.

<dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
  <version>1.18.2</version>
  <scope>provided</scope>
</dependency>

Original Author Of This Content

Solution 2

I also got this error, when using jdk 10 to compile java8 source code.

maven compile error

After changing environment variable JAVA_HOME to jdk8 home dir, this error disappear.

Original Author Of This Content

Solution 3

It could be a reason of getting this issues while running application Intellij that you haven’t configuration Project SDK setting in IDE.

enter image description here

Original Author Of This Content

Solution 4

Add this to pom.xml:

<dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
  <version>1.18.20</version>
  <scope>provided</scope>
</dependency>

Original Author Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment