Raja G
Raja G

Reputation: 6643

AEM6.2: com.day.cq.wcm.tags.IncludeTag Error

We have AEM6.2 node environment and we are trying to access login.html but getting error as below.

After searching I came to know that java version could be one of the possible reason but I am already using Java 8 for this application. I am out of ideas. Any suggestions greatly appreciated.

14.09.2018 14:08:40.299 *ERROR* [192.156.110.11 [1536948520114] GET /content/en/account/login.html HTTP/1.1] com.day.cq.wcm.tags.IncludeTag Error while executing script defaulttopnav
org.apache.sling.api.scripting.ScriptEvaluationException:
        at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:416)
        at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184)
        at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491)
        at com.day.cq.wcm.tags.IncludeTag.includeScript(IncludeTag.java:178)
        at com.day.cq.wcm.tags.IncludeTag.doEndTag(IncludeTag.java:95)
        at org.apache.jsp.apps.components.navigation.topnavigation_jsp._jspService(navigation_jsp.java:329)
        at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.sling.api.SlingException:
        at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:691)
        at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:608)
        at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:533)
        at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
        at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:284)
        at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:102)
        at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:536)
        at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388)
        ... 201 common frames omitted
Caused by: java.lang.NullPointerException: null
        at org.apache.jsp.apps.components.topnavigation.defaulttopnav_jsp._jspService(defaulttopnav_jsp.java:347)
        at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
        at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
        ... 206 common frames omitted

Thank you.

Upvotes: 0

Views: 2555

Answers (2)

Saravana Prakash
Saravana Prakash

Reputation: 1323

General solution for errors are thrown by servlets compiled from jsp files, is to recompile the jsp again.

  1. Goto system/console and verify if all bundles are in active state
  2. Goto sling --> jsp and recompile all jsps.

This works if errors are thrown from otb jsp. However when custom application jsps throw error, you ll need to fix the custom jsp code by handling the error.

Another foolproof way to clear cached jsp class files is to delete /var/classes

Upvotes: 1

SubSul
SubSul

Reputation: 2563

The stacktrace indicates the NPE is stemming from defaulttopnav_jsp.java, line 347. Analysing the generated java file is the way to go.

Since AEM 6.1, the default ClassLoader was replaced by FSClassLoader and the generated .java files are no longer stored under /var/classes.

To locate the .java file you will need to locate the bundle ID for the FSClassLoader bundle, then the java files will be located at:

[AEM_INSTALL_DIR]/crx-quickstart/launchpad/felix/bundle[BUNDLE_ID]/data/classes

There is also a sling plugin which will help you view the generated java file from OSGi console. Check out these posts for that.

Upvotes: 1

Related Questions