cancel
Showing results for 
Search instead for 
Did you mean: 

error with ContentHitsAspect (sample given by alfresco)

ranj
Champ on-the-rise
Champ on-the-rise
Hi,
Am working with alfresco 4.0.b..I have used the ContentHitsAspect which is given in alfresco samples(sdk). After deploying all the files and starting the service it gives error in the following methods :
                      policyFilter.disableBehaviour(nodeRef, ASPECT_CONTENT_HITS);
                      policyFilter.enableBehaviour(ASPECT_CONTENT_HITS);
log file:

2012-05-11 11:25:34,105  ERROR [alfresco.sample.ContentHitsAspect] [defaultAsyncAction2] Failed to increment content read count on node: workspace://SpacesStore/c2f051fd-648d-46dc-99af-79c5fed60cef
org.alfresco.error.AlfrescoRuntimeException: 04110109 Exception in Transaction.
                at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:473)
                at org.alfresco.sample.ContentHitsAspect$ContentHitsReadCountIncrementer.run(ContentHitsAspect.java:296)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoSuchMethodError: org.alfresco.repo.policy.BehaviourFilter.disableBehaviour(Lorg/alfresco/service/cmr/repository/NodeRef;Lorg/alfresco/service/namespace/QName;)V
                at org.alfresco.sample.ContentHitsAspect$ContentHitsReadCountIncrementer$1.execute(ContentHitsAspect.java:280)
                at org.alfresco.sample.ContentHitsAspect$ContentHitsReadCountIncrementer$1.execute(ContentHitsAspect.java:1)
                at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
                … 4 more

When i remove the two methods from the code..its working without errors..but the hit count increases everytime i restart the alfresco service..so this is again a problem.
Need some help with this..is this a problem with the sample files? :?

Thanks in advance,
Ranj
4 REPLIES 4

mitpatoliya
Star Collaborator
Star Collaborator
Are you using the sdk for the same version?
Because there was a error in this example in SDK of around 3.2 version. Smiley Happy

ranj
Champ on-the-rise
Champ on-the-rise
Hi Mitpatoliya,

Yes am using the same sdk..using 4.0.b community..Now i ve fixed the exceptions and errors..but the count gets increased drastically every 2 mins or so , even when the document is not read or downloaded..couldnt undersatand this.. Smiley Sad  Smiley Sad  Smiley Sad  Smiley Sad

Thanks,
Ranj

kbryd
Champ in-the-making
Champ in-the-making
Now i ve fixed the exceptions and errors..but the count gets increased drastically every 2 mins or so , even when the document is not read or downloaded..couldnt undersatand this.

I have the same problem.

I played with disabling behaviors for the node but still the behavior code is executed every exactly 15 seconds.

Could it be that the FTS indexer is triggering it? SOLR is configured to run it's job every 15 seconds so this could be it, but how to turn it off?

kbryd
Champ in-the-making
Champ in-the-making
I will answer myself, but perhaps someone will find it useful:

Adding:

   if(AuthenticationUtil.getFullyAuthenticatedUser() == null) {
         return;
   }

to the onContentRead() method seems to filter out those events which aren't coming from normal authenticated users. So this should filter out those SOLR events.