title: Debugging a Java program running from Tomcat (JSP)
body: <p>I don't know why I never found myself having to use a debugger to step through my program and see what was going on, probably because I'm used to using interpreted languages such as PHP where it becomes very easy to add debugging code (<code>print_r</code>) and see changes live.</p>
  
  <p>However with this new Java project I feel like I must learn the correct ways of debugging. </p>
  
  <p>So this program, that I didn't write, runs on Tomcat and uses basic JSPs. The issue is that when I try to access a specific JSP page it throws an exception and gives me the stacktrace of what happened:</p>
  
  <pre><code>org.apache.jasper.JasperException: java.lang.NullPointerException
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:503)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:363)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:306)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      org.sgrp.singer.filters.SingerLoginFilter.doFilter(SingerLoginFilter.java:128)
  </code></pre>
  
  <p>How would I step through my program using a tool such as JDB? I can't really step through a specific class because I need to mimic what my JSP is doing... I would like to do this through the command-line, without using an IDE.</p>