cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Trashcan Cleaner - error during execution by cron

tomekszy
Confirmed Champ
Confirmed Champ

I have installed alfresco-trashcan-cleaner AMP, and of course I have a problem with that Smiley Happy

I got in my log:

2016-11-03 04:00:00,388 ERROR [org.quartz.core.JobRunShell] [DefaultScheduler_Worker-6] Job DEFAULT.tempFileCleanerJobDetail#1 threw an unhandled Exception:
java.lang.NullPointerException
at org.alfresco.trashcan.TrashcanCleaner.olderThanDaysToKeep(TrashcanCleaner.java:102)
at org.alfresco.trashcan.TrashcanCleaner.fillBatchToDelete(TrashcanCleaner.java:84)
at org.alfresco.trashcan.TrashcanCleaner.getBatchToDelete(TrashcanCleaner.java:75)
at org.alfresco.trashcan.TrashcanCleaner.clean(TrashcanCleaner.java:48)
at org.alfresco.trashcan.TrashcanCleanerJob$1.execute(TrashcanCleanerJob.java:36)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:457)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
at org.alfresco.trashcan.TrashcanCleanerJob.cleanInTransaction(TrashcanCleanerJob.java:40)
at org.alfresco.trashcan.TrashcanCleanerJob.executeJob(TrashcanCleanerJob.java:29)
at org.alfresco.schedule.ScheduledJobLockExecuter.execute(ScheduledJobLockExecuter.java:93)
at org.alfresco.schedule.AbstractScheduledLockedJob.executeInternal(AbstractScheduledLockedJob.java:71)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:114)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
2016-11-03 04:00:00,391 ERROR [org.quartz.core.ErrorLogger] [DefaultScheduler_Worker-6] Job (DEFAULT.tempFileCleanerJobDetail#1 threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NullPointerException]
at org.quartz.core.JobRunShell.run(JobRunShell.java:227)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
Caused by: java.lang.NullPointerException
at org.alfresco.trashcan.TrashcanCleaner.olderThanDaysToKeep(TrashcanCleaner.java:102)
at org.alfresco.trashcan.TrashcanCleaner.fillBatchToDelete(TrashcanCleaner.java:84)
at org.alfresco.trashcan.TrashcanCleaner.getBatchToDelete(TrashcanCleaner.java:75)
at org.alfresco.trashcan.TrashcanCleaner.clean(TrashcanCleaner.java:48)
at org.alfresco.trashcan.TrashcanCleanerJob$1.execute(TrashcanCleanerJob.java:36)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:457)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
at org.alfresco.trashcan.TrashcanCleanerJob.cleanInTransaction(TrashcanCleanerJob.java:40)
at org.alfresco.trashcan.TrashcanCleanerJob.executeJob(TrashcanCleanerJob.java:29)
at org.alfresco.schedule.ScheduledJobLockExecuter.execute(ScheduledJobLockExecuter.java:93)
at org.alfresco.schedule.AbstractScheduledLockedJob.executeInternal(AbstractScheduledLockedJob.java:71)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:114)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
... 1 more

My settings from alfresco-global.properties are:

system.content.eagerOrphanCleanup=true
trashcan.cron=0 0 4 * * ?
trashcan.daysToKeep=1
trashcan.deleteBatchCount=1000
log4j.logger.org.alfresco.trashcan=debug
trashcan.cleaner.cron=0 0 4 * * ?
trashcan.cleaner.protected.day=1

I think it could be related with bad settings in alfresco-global.properties, but I don't know which are proper. I tried to change the storeUrl parameter in services-context.xml file, but I couldn't find store Url parameter.
My Alfresco version is Community-5.1.0, and i use trashcan AMP version 1.2

1 ACCEPTED ANSWER

kaynezhang
World-Class Innovator
World-Class Innovator

No ,you configuration is ok .

I think it is a bug here and the quickest way is to download source code from https://github.com/rjmfernandes/alfresco-trashcan-cleaner.

Modify the code and add a conditional judgment in method olderThanDaysToKeep of org.alfresco.trashcan.TrashcanCleaner class ,replace the org.alfresco.trashcan.TrashcanCleaner class in your amp with your modified version and reinstall the amp.

View answer in original post

9 REPLIES 9

cesarista
World-Class Innovator
World-Class Innovator

Hi:

I'm not completely sure, I used the first link below some time ago in Alfresco 4.x. In github documentation says both are designed for Alfresco 4.x

GitHub - atolcd/alfresco-trashcan-cleaner

GitHub - rjmfernandes/alfresco-trashcan-cleaner: Automatically exported from code.google.com/p/alfre...

Regards.

--C.

Well, the AMP module is shown in Module Manager, alfresco after installing AMPs have started normally, and everything looks fine. I had some other modules earlier, that was designed to other version of Alfresco, or just didn't worked, and they weren't showed in Module Manager, and sometimes Alfresco didn't started with them installed in WAR files. I don't have that problem with this extension, so I assume, it should be proper for my version.

But I have doubts is my configuration is OK... the part

at org.alfresco.trashcan.TrashcanCleaner.olderThanDaysToKeep(TrashcanCleaner.java:102)

at org.alfresco.trashcan.TrashcanCleaner.fillBatchToDelete(TrashcanCleaner.java:84)

at org.alfresco.trashcan.TrashcanCleaner.getBatchToDelete(TrashcanCleaner.java:75)

at org.alfresco.trashcan.TrashcanCleaner.clean(TrashcanCleaner.java:48)

looks like something is messed up with my settings in alfresco-global file, because these errors looks similar, like config variables names. I think so, but of course I'm not sure

kaynezhang
World-Class Innovator
World-Class Innovator

Cloud you please attach your amp here ?

Here it is. I have copied it to amps and amps_shared directory, and installed it by bin/apply_amps.sh script.

Dropbox - alfresco-trashcan-cleaner-amp-1.2.amp

kaynezhang
World-Class Innovator
World-Class Innovator

I'm sorry I can't download it ,can you email it to me kaynezhang@gmail.com

kaynezhang
World-Class Innovator
World-Class Innovator

It seems some nodes in archive://SpacesStore don't have sys:archivedDate property of archived aspect.

Ok, so how can I repair this problem? Do I need to manually change all file properties? Or do I have to make some rule? Maybe I have configured something wrong?

kaynezhang
World-Class Innovator
World-Class Innovator

No ,you configuration is ok .

I think it is a bug here and the quickest way is to download source code from https://github.com/rjmfernandes/alfresco-trashcan-cleaner.

Modify the code and add a conditional judgment in method olderThanDaysToKeep of org.alfresco.trashcan.TrashcanCleaner class ,replace the org.alfresco.trashcan.TrashcanCleaner class in your amp with your modified version and reinstall the amp.

cesarista
World-Class Innovator
World-Class Innovator

Hi:

It seems that trashcan is part of 5.2 Community

Regards.

--C.