Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

EventListener AEM 6.5 Is not working

Avatar

Level 2

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;

@reference
private ResourceResolverFactory resourceResolverFactory;

private static final String SUBSERVICE = "readAccess";


@activate
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);
}
}


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

 

 

6 Replies

Avatar

Community Advisor

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.

Avatar

Level 2

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

Avatar

Community Advisor

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? 

Avatar

Level 2

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

Avatar

Community Advisor

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-...

 

Avatar

Level 2

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.