JCR - EventListener - activate method not found - Adobe CQ 5.6.0 | Community
Skip to main content
October 16, 2015
Solved

JCR - EventListener - activate method not found - Adobe CQ 5.6.0

  • October 16, 2015
  • 2 replies
  • 963 views

I'm trying to implement an EventListener to propagate some JCR changes (property changed, node added ...).

This topic has been discussed in a number of posts but different implementations are available and I'm inclined to describe the nitty gritty details on the required annotation as a very well kept secret.

SlingRepository is annotated without specific properties in following document:http://experiencedelivers.adobe.com/cemblog/en/experiencedelivers/2012/04/event_handling_incq.html

and Component annotation has been set the following way:

@Component public class JCRListener implements EventListener{ }

With this flavor, I'm able to install my bundle from the Adobe CQ Web Console but my Active and Deactive methods are not triggered/invoked.

SlingRepository is annotated with specific properties (policy = ReferencePolicy.STATIC, cardinality = ReferenceCardinality.MANDATORY_UNARY) in following document:https://groups.google.com/forum/#!topicsearchin/day-communique/postEvent%7Csort:date%7Cspell:true/day-communique/BvJsgMzpsAM

and Component annotation has a specific setting

@Component(immediate=true) @Service public class JCRListener implements EventListener{ @Activate public void activate(ComponentContext componentContext){ .... } @Deactivate public void deactivate(ComponentContext componentContext){ .... } public void onEvent(EventIterator events) { .... } }

With this flavor, the deployment of my bundle fails and I'm getting the error[com.adobe.cq.JCRListener] activate method [activate] not found; Component will fail

I attache the complete code to facilitate investigation of the problem. Any help is very much appreciated, don't hesitate to let me know additional logging should be provided/enabled. 

Wim

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

I would make the activate and deactivate methods in protected scope, not public.

2 replies

smacdonald2008
Level 10
October 16, 2015

A new community article on this subject will be published on April 18, 2014. I will update this thread once it is published. 

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

I would make the activate and deactivate methods in protected scope, not public.