Page throws NullPointerException upon activation in AEM sites

When a page is activated in Adobe Experience Manager, the activation fails with a NullPointException message due to a missing cq:lastReplicated property in one of the referenced images. Follow the steps outlined in this article to resolve the issue.

Description description

Environment

Adobe Experience Manager 6.x

Issue/Symptoms

When a page is activated in AEM, the activation fails with the following exception:

javax.servlet.ServletException: java.lang.NullPointerException
at com.day.cq.wcm.core.impl.reference.ActivationReferenceSearchServlet.doGet(ActivationReferenceSearchServlet.java:175)
at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:269)

Cause

One of the images referenced by the page had an issue with its properties.

The image causing issues was missing the cq:lastReplicated property while it had the cq:lastReplicatedBy and cq:lastReplicationAction properties.

Specified Messages

javax.servlet.ServletException: java.lang.NullPointerException
at com.day.cq.wcm.core.impl.reference.ActivationReferenceSearchServlet.doGet
at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService

Resolution resolution

Resolution

  1. Identify all the images which have this conflict:

    code language-none
    SELECT * FROM [ dam:Asset]  AS parent INNER JOIN [ nt:base]  AS child ON ISCHILDNODE(child, parent) WHERE ISDESCENDANTNODE(parent, '/content/dam/journey/') AND child.[ cq:lastReplicated]  IS NULL AND child.[ cq:lastReplicatedBy]  IS NOT NULL
    
  2. Once the assets are identified, check if these assets were replicated or not.

  3. If Yes, add the property cq:lastReplicated with the type Date and copy the date from the publish server.

  4. In either case, you can remove the cq:lastReplicatedBy and cq:lastReplicatedAction properties and activate the image again.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f