Monday, August 4, 2014

How to debug JSP with help of compiled Java files in Eclipse

When I'm trying to access my jsp page, some of my code causing the problem and  it ran into some exception :P. But I know there is something wrong and want to resolve the issue and I'm not sure on how to debug a jsp file in eclipse while it is executing. I'm seeing the exception after the execution and only clue is this stacktrace. So this is the exception i'm facing.

HTTP ERROR 500 Problem accessing/index.jsp.

 Reason: Server Error Caused by: java.lang.NullPointerException at   
 org.apache.jsp.login_jsp._jspService( at   
 org.apache.jasper.runtime.HttpJspBase.service( at   
 javax.servlet.http.HttpServlet.service( at   
 org.apache.jasper.servlet.JspServletWrapper.service( at org.apache.jasper.servlet.JspServlet.serviceJspFile( at   
 org.apache.jasper.servlet.JspServlet.service( at   

From the stack trace it is clear that something is null in the code. It is at line no 139. 

That is not the line no in login.jsp  but the compiled file  As we all know, JSP converted to Java and then executes. The line numbers showing in the stacktrace are from that compiled java file. Cool , the question now is where is that compiled file stored to see the cause of error ?

Finally I found the place where the compiled jsp files. Here you can see the two files,

Do not touch that .class file and open the file. From the stack-trace 


And the line no 139 in is 

 parent= domain.startsWith("www.") ? domain.substring(3) : domain;

It clear that the only reason here to NullPointerException is domain.And I resolved that error. That's it. 

 How crap JSP is :-/.

Next >> Difference between final and effectively final in java 


  1. Replies
    1. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the authors explore the idea of using Java in Big Data platforms.

      Spring Training in Chennai

      The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

  2. The article is so appealing. You should read this article before choosing the Hadoop consulting services you want to learn.

  3. Really this is very good information. I really enjoyed it. Thank you for sharing the informatin. Keep on sharing the information.
    Python Training in chennai

    Python Course in chennai

  4. wonderful article contains lot of valuable information. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
    This article resolved my all queries.good luck an best wishes to the team members. learn digital marketing use these following links
    Digital Marketing Course in Chennai