title: java.lang.NullPointerException at org.apache.jsp.foo_jsp._jspInit(foo_jsp.java:22)
body: <p>I have spring mvc application with dummy jsp page (named htmlcontent.jsp). The jsp contains just a string:</p>
  
  <pre><code>HalloText
  </code></pre>
  
  <p>and this is the entire content of the jsp. The controller looks as follow:</p>
  
  <pre><code>package springapp.web;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  @Controller
  public class HtmlContentController {
  
      @RequestMapping("/htmlcontent.htm")
      public String view() {
          return "htmlcontent";
      }
  }
  </code></pre>
  
  <p>The bean is added in my springapp-web.xml</p>
  
  <pre><code>&lt;bean id="htmlcontent" class="springapp.web.HtmlContentController"&gt;
  </code></pre>
  
  <p>And the servlet mapping in my web.xml is defined as follow:</p>
  
  <pre><code>&lt;servlet-mapping&gt;
      &lt;servlet-name&gt;springapp&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.htm&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>When i call following:</p>
  
  <pre><code>http://localhost:8080/spring-mvc-hsqldb/htmlcontent.htm
  </code></pre>
  
  <p>then i get an NullPointerException:</p>
  
  <pre><code>HTTP Status 500 -
  
  type Exception report
  
  message
  
  description The server encountered an internal error () that prevented it from fulfilling this request.
  
  exception
  
  org.apache.jasper.JasperException: java.lang.NullPointerException
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:536)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  
  root cause
  
  java.lang.NullPointerException
      org.apache.jsp.htmlcontent_jsp._jspInit(htmlcontent_jsp.java:22)
      org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
      org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:164)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:338)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  
  note The full stack trace of the root cause is available in the Apache Tomcat/6.0.30 logs.
  </code></pre>
  
  <p>In catalina.out there isn't any stack trace for this error. When i try to change the URL to <code>http://localhost:8080/spring-mvc-hsqldb/htmlcondsasdadastent.htm</code>, then i get:</p>
  
  <pre><code>WARNUNG: No mapping found for HTTP request with URI [/spring-mvc-hsqldb/htmlcondsasdadastent.htm] in DispatcherServlet with name 'springapp'
  </code></pre>
  
  <p>So i think, that must be the right log file. Can someone give me a hint, what i'm doing wrong? And why is the null pointer stack trace not in the log file?</p>