title: Spring not accessing JSP inside /WEB-INF/jsp/ folder
body: <p>I am new to Spring MVC and developing an application. I developed a project with the help of Spring MVC Tutorial.Initially, it was working. But as soon as I upgraded my project with Hibernate 4 and Spring 4. It stopped working. Whenever, I am invoking any \WEB-INF\jsp, I am getting 404 Error.</p>
  
  <p>Files</p>
  
  <p><strong>LoginController</strong> </p>
  
  <pre><code> public class LoginController {
          @RequestMapping(value="/login", method=RequestMethod.GET)
          public ModelAndView showLoginPage(String path, ModelMap model){
              ModelAndView mv = new ModelAndView("login");
              model.addAttribute("welcome to Flight Services", "welcomeMessage");
              return mv;
          }
      }
  </code></pre>
  
  <p><strong>Spring-servlet.xml</strong></p>
  
  <pre><code>&lt;beans ......-mvc-4.0.xsd"&gt;
  &lt;mvc:annotation-driven /&gt;
  &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"&gt;&lt;/property&gt;
      &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
  &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>applicationContext.xml</strong></p>
  
  <pre><code>        &lt;beans xmlns="http://www.springframework.org/schema/beans"  xmlns:mvc="http://www.springframework.org/schema/mvc" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"
          xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:util="http://www.springframework.org/schema/util"
          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
              http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
              http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
              http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
              http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
               http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"&gt;
  
      &lt;context:annotation-config/&gt;
      &lt;mvc:annotation-driven /&gt;
  
          &lt;bean id="propertyConfigurer"
              class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
              p:location="/WEB-INF/jdbc.properties"&gt;
          &lt;/bean&gt;
          &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
          p:driverClassName="${jdbc.driverClassName}"
          p:url="${jdbc.databaseurl}"
          p:username="${jdbc.username}"
          p:password="${jdbc.password}"&gt;
  
          &lt;/bean&gt;
  
          &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
              &lt;property name="dataSource" ref="dataSource" /&gt;
              &lt;property name="configLocation"&gt;
               &lt;value&gt;classpath:hibernate.cfg.xml&lt;/value&gt;
               &lt;/property&gt;
              &lt;property name="hibernateProperties"&gt;
                  &lt;props&gt;
                      &lt;prop key="hibernate.dialect"&gt;${jdbc.dialect}&lt;/prop&gt;
                      &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                  &lt;/props&gt;
              &lt;/property&gt;     
          &lt;/bean&gt;
              &lt;tx:annotation-driven transaction-manager="transactionManager"&gt;&lt;/tx:annotation-driven&gt;
  
          &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
              &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
          &lt;/bean&gt;
      &lt;/beans&gt;
  </code></pre>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;display-name&gt;AirportService&lt;/display-name&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>index.jsp</strong></p>
  
  <pre><code>        &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
          pageEncoding="ISO-8859-1"%&gt;
          &lt;%@include file="/WEB-INF/jsp/include.jsp" %&gt;
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
      &lt;title&gt;Insert title here&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;c:redirect url="/home" /&gt; 
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Now everytime, I am launching my index page. I am getting this error</p>
  
  <pre><code>    org.apache.jasper.JasperException: /index.jsp (line: 3, column: 5) File "/WEB-INF/jsp/include.jsp" not found
      org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
      org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
      org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:133)
      org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:322)
      org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:357)
      org.apache.jasper.compiler.Parser.parseDirective(Parser.java:467)
      org.apache.jasper.compiler.Parser.parseFileDirectives(Parser.java:1779)
      org.apache.jasper.compiler.Parser.parse(Parser.java:135)
      org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
      org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:119)
      org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:193)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  </code></pre>