如何解决
java.lang.ExceptionInInitializerError
at org.alfresco.trashcan.TrashcanCleanerTest.<clinit>(TrashcanCleanerTest.java:67)
我拉下 https://github.com/Alfresco/alfresco-trashcan-cleaner-module 跑mvn clean install
它失败了:
-------------------------------------------------------
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
它无法运行此行:private static ApplicationContext applicationContext = ApplicationContextHelper.getApplicationContext();
问题是为什么?
我的爪哇是
$ 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)
也许我试图跑错了。 我错过了哪一步?
尝试通过执行mvn clean install -DskipTests
跳过测试