. Advertisement .
..3..
. Advertisement .
..4..
The error: “java.lang.ExceptionInInitializerError at org.apache.maven.plugin.war.WarMojo.(Unknown Source) while locating org.apache.maven.plugin.war.WarMojo” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
How To Solve The Error: “java.lang.ExceptionInInitializerError at org.apache.maven.plugin.war.WarMojo.(Unknown Source) while locating org.apache.maven.plugin.war.WarMojo”?
When trying to execute your Java application, you may get the following error.
Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision, see the following errors:
Error injecting constructor, java.lang.ExceptionInInitializerError at org.apache.maven.plugin.war.WarMojo.<init>(Unknown Source) while locating org.apache.maven.plugin.war.WarMojo
Simply configure the war plugin in your POM.xml to fix this issue. The second option is to simply change your JDK for a specific project. This is the next step. To begin, left-click on the project you want to work on. Then choose Properties from the drop-down menu. Choose Build now. Choose compile. Version 14 of the Java Development Kit (JDK) should be used. If you don’t already have JDK 14, you can get it here. Your problem has now been resolved.
Approach 1: Configure war plugin
Simply configure the war plugin in your POM.xml like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
Approach 2: Modify JDK for your project
Simply change your JDK for a specific project. This is the next step.
- To begin with, left-click on the project you want to work on.
- Next, choose Properties from the drop-down menu.
- Choose Build now.
- Choose compile.
- Version 14 of the Java Development Kit (JDK) should be used.
- If you don’t already have JDK 14, you can get it here.
- Your problem has now been resolved.
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “java.lang.ExceptionInInitializerError at org.apache.maven.plugin.war.WarMojo.(Unknown Source) while locating org.apache.maven.plugin.war.WarMojo” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Leave a comment