EventListener AEM 6.5 Is not working | Adobe Higher Education
Skip to main content
Level 2
April 27, 2022

EventListener AEM 6.5 Is not working

Hello, I am upgrading from AEM 6.4 to AEM 6.5, what happens is that the vanityPaths are not being generated automatically (in version 6.4 it worked without problems). I suspect it has to do with the class that implements EventListener

 

private Session session;

@3214626
private ResourceResolverFactory resourceResolverFactory;

private static final String SUBSERVICE = "readAccess";


@580286
public final void activate(ComponentContext context) throws RepositoryException {
log.debug("Activating PropertyAddedObservation");

String[] nodetypes = {"cq:PageContent"};
Map<String, Object> authInfo = Collections.singletonMap(ResourceResolverFactory.SUBSERVICE,
(Object) SUBSERVICE);
try (ResourceResolver administrativeResourceResolver = resourceResolverFactory.getServiceResourceResolver(authInfo)) {

session = administrativeResourceResolver.adaptTo(Session.class);
session.getWorkspace().getObservationManager().addEventListener(this, Event.PROPERTY_ADDED,
Constants.CONTINGENCYPATH, true, null, nodetypes, false);
} catch (RepositoryException e) {
throw new RepositoryException(e);
} catch (LoginException e) {
log.error("PropertyAddedObservation", e);
}
}


@3038739
public final void deactivate() {
if (session != null) {
session.logout();
}
}

 

 

Ce sujet a été fermé aux réponses.

3 commentaires

Kiran_Vedantam
Community Advisor
Community Advisor
April 27, 2022

Hi @juancarlos2022 

 

Can u check what the error log says? Also, can you check if this issue is happening to only one path?

 

Thanks,

Kiran Vedantam.

Level 2
April 28, 2022

Hi @kiran_vedantam 

 

It tried with other paths, but I haven't been able to either, what I have noticed is that when I try in my local, the vanityPath is created automatically but by the publisher side

Ravi_Pampana
Community Advisor
Community Advisor
April 27, 2022

Hi,

Upgrade should not impact the event listener, are you seeing any exceptions in logs? Can you check whether the system user permissions are same in both AEM 6.4 and AEM 6.5? Did your code is not executing in AEM 6.5? 

Level 2
April 28, 2022

Hi @ravi_pampana 

 

I do not see any log in error.log, I have tried to save custom logs but it does not save any of the java class.In both environments, administrator permissions are being used. Running AEM 6.5.10

Nitin_laad
Community Advisor
Community Advisor
April 27, 2022

Hey @juancarlos2022  it appears that the issue is with the theresourceResolverFactory.getServiceResourceResolver(authInfo) method invocation. 

Can you please check if session = repository.loginService("readService",null); works for you. 

 

Ref - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/eventlistener-event-never-triggered/m-p/241247#M10515

 

Level 2
April 28, 2022

Hi @nitin_laad 

 

I have tried with this that you mention, and also with loginAdministrative, but still the vanityPath is not generated automatically. The funny thing is that when I test on my site, it is generated automatically by the publisher side.