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

cancel
Showing results for 
Search instead for 
Did you mean: 
aowian
Active Member II

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

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)
4 Replies
cesarista
Customer

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

Hi:

What Alfresco version are you using ? Do you know that last Alfresco CE GA (201707) includes the thrascan cleaner ? 

Regards.

--C.

aowian
Active Member II

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

I'm on Enterprise 5.1.3

Yes, I know that 5.2.x includes it.

I also know that for large trashcans, the current trashcan cleaner will kill the server, because it gets all child associations instead of getting only a limited number.  That's why I'm trying to change it, but I'm stuck not able to run the tests. 

See java.lang.OutOfMemoryError: Java heap space due to no limit on getChildAssocs · Issue #2 · Alfresco/... 

cesarista
Customer

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

Hi Ahmed:

Good to know, but I think the idea is not to have a large trashcan, or doing massive deletions (if fact any massive action in the repo).

Another approach I used in Alfresco 5.1 is to use Javascript Console for manually deleting documents and folders with something like:

limpeza lixeira alfresco.js · GitHub 

Delete first documents, and then folders in batches.

If you plan massive deletions, you can delete using (adding) sys:temporary aspect for not passing via Thrashcan.

Regards.

--C.

aowian
Active Member II

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

We just accumulated a large trashcan over time, and now we decided to clean it up.  This use case is not supported with the current Alfresco Trashcan Cleaner module.  The original author even acknowledged it with a TODO in the code.

Do you have any idea why I can't run the tests?