Saturday, March 28, 2015

NullPointerException: currentDesign.getDoctype(currentStyle).toRequest(request) - AEM/Adobe CQ5

NullPointerException:  currentDesign.getDoctype(currentStyle).toRequest(request) - AEM/Adobe CQ5

We were getting the NullpoiterException while accessing the pages in Adobe Experience Manager(AEM)

Caused by: java.lang.NullPointerException
at org.apache.jsp.apps.sample.design.components.pages.pageShell.pageShell_jsp._jspService(pageShell_jsp.java:227)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
... 117 more

NullpointerException is thrown while getting the Doctype of the page design.

if (currentDesign != null) {
        currentDesign.getDoctype(currentStyle).toRequest(request);
    }

This issue was getting resolved after restarting the server.

After analysis the currentDesign  and currentStyle objects are not null and getDoctype method is throwing NullpoiterException.

The currentStyle  refers to the path (currentStyle.getPath())- /etc/designs/default.

By default /etc/designs/default/jcr:content path will not have cq:doctype property specified.

To resolve the issue we have added the  cq:doctype - html_5 property to /etc/designs/default/jcr:content

doctype_html5

If the property is already available then delete the same and add again.


No comments:

Post a Comment