AnsweredAssumed Answered

java.lang.ExceptionInInitializerError at org.alfresco.trashcan.TrashcanCleanerTest.<clinit>(TrashcanCleanerTest.java:67)

Question asked by aowian on Jun 26, 2018
Latest reply on Jun 28, 2018 by aowian

How can I solve 

java.lang.ExceptionInInitializerError
at org.alfresco.trashcan.TrashcanCleanerTest.<clinit>(TrashcanCleanerTest.java:67)

 

I pulled down GitHub - Alfresco/alfresco-trashcan-cleaner-module and ran

mvn clean install

It failed with this:

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.alfresco.trashcan.TrashcanCleanerTest
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 17.477 sec <<< FAILURE! - in org.alfresco.trashcan.TrashcanCleanerTest
testCleanBatch(org.alfresco.trashcan.TrashcanCleanerTest)  Time elapsed: 0.007 sec  <<< ERROR!
java.lang.ExceptionInInitializerError
at org.alfresco.trashcan.TrashcanCleanerTest.<clinit>(TrashcanCleanerTest.java:67)

testCleanSimple(org.alfresco.trashcan.TrashcanCleanerTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.alfresco.trashcan.TrashcanCleanerTest


Results :

Tests in error:
  TrashcanCleanerTest.testCleanBatch » ExceptionInInitializer
  TrashcanCleanerTest.testCleanSimple » NoClassDefFound Could not initialize cla...

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.667 s
[INFO] Finished at: 2018-06-26T13:05:46-04:00
[INFO] Final Memory: 76M/3925M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project alfresco-trashcan-cleaner: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/owiana/Downloads/alfresco-trashcan-cleaner-module-master/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

It's failing to run this line:

private static ApplicationContext applicationContext = ApplicationContextHelper.getApplicationContext();

 

The question is Why?

 

My java is 

$ java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

Outcomes