title: RequestDispatcher forward to jsp being caught by servlet url pattern
body: <p>I have a jsp located in the <code>/package</code> directory.</p>
  
  <p>Then I map my servlet with a WebServlet Annotation of <code>"/package/*"</code>.</p>
  
  <p>In my servlet, I forward the request to a jsp in the above directory:</p>
  
  <pre><code>        RequestDispatcher dispatcher = 
                  request.getServletContext().getRequestDispatcher("/package/some_file.jsp");
          dispatcher.forward(request, response); 
  </code></pre>
  
  <p>This causes a StackOverflowError:</p>
  
  <blockquote>
    <p>org.apache.catalina.core.ApplicationDispatcher.invoke
    Servlet.service() for servlet SomeServlet threw exception</p>
  </blockquote>
  
  <p>I can easily fix this by changing the name of the jsp folder to something else (eg: <code>package_files</code>). But I don't understand why this is necessary because I thought the servlets and the jsp folders were in entirely different locations (specifically, the servlet is in <code>/web/WEB-INF/classes/package</code> while the jsp is in <code>/web/package</code>.</p>
  
  <p>Am I mistaken, or is there something wrong with my setup?</p>
  
  <p>Thank you.</p>