2 Replies Latest reply on Mar 12, 2013 7:07 AM by MatheusOliveira


    HarishDv Level 1

      Hi All ,


      I am getting null pointer exception in my logs ffrom the default java class files.


      Caused by: java.lang.NullPointerException

      at com.day.cq.collab.commons.impl.CommentBase.countComments(CommentBase.java:95)

      at com.day.cq.collab.commons.impl.CommentBase.countComments(CommentBase.java:85)

      at org.apache.jsp.apps.collab.commons.components.commentsDisplayNumber.fredhopperXML_jsp._js pService(fredhopperXML_jsp.java:171)

      at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

      at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:419)


      Can anyone please explain as to why this problem is occuring and suggest solution to overcome this error.


      I have checked the commentBase.java file and i am able to see only " if " statement in that line.

      I dont understand why i amgetting this error.

      I am using CQ5.3.



      Harish Dv

        • 1. Re: NullPointerException
          Sham HC Level 7

          Hi Harish,


          It should be issue at your custom implementation. Verify your components at /apps/collab/commons




          • 2. Re: NullPointerException
            MatheusOliveira Level 1

            Hey Harish,


               Completing the answer, you get NullPointer Exceptions when you try to use a Java object that haven't been inicialized before. Try to deactivate some of your components and test the page, doing this you'll find out which component is causing the exception.

               Then, check out in the JSP or any associated Java Bundles if there is any object which haven't been initializated.


               You can also try to adapt your CQ code to normal Java classes and test it on a Java normal IDE, like Eclipse or NetBeans.


            Good luck!