I've got a Tomcat deployment with a single webapp living inside web/WEB-INF
. Here is the way I'm instantiating the spring container:
<servlet>
<servlet-name>report</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/report-servlet.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>report</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
The report-servlet.xml
file is found, loaded and parsed properly.
However, my JSP views do not resolve. Here is my resolver:
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
I have the root URL mapped to /welcome:
<!-- Forwards requests to the "/" resource to the "welcome" view -->
<mvc:view-controller path="/" view-name="welcome"/>
And this view is found and delegated to the InternalResourceViewResolver
when I request http://localhost/
, but the .jsp is not found:
[org.springframework.web.servlet.view.InternalResourceView] (http-11080-1) Rendering view with name 'welcome' with model null and static attributes {}
[org.springframework.web.servlet.view.InternalResourceView] (http-11080-1) Forwarding to resource [/WEB-INF/views/welcome.jsp] in InternalResourceView 'welcome'
[org.springframework.web.servlet.DispatcherServlet] (http-11080-1) Bound request context to thread: org.apache.catalina.core.ApplicationHttpRequest@10ea443f
[org.springframework.web.servlet.DispatcherServlet] (http-11080-1) DispatcherServlet with name 'report' processing GET request for [//WEB-INF/views/welcome.jsp]
[org.springframework.web.servlet.DispatcherServlet] (http-11080-1) Testing handler map [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping@4ab83be0] in DispatcherServlet with name 'report'
[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] (http-11080-1) No handler mapping found for [/WEB-INF/views/welcome.jsp]
[org.springframework.web.servlet.DispatcherServlet] (http-11080-1) Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@2c1533c8] in DispatcherServlet with name 'report'
[org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] (http-11080-1) No handler mapping found for [/WEB-INF/views/welcome.jsp]
[org.springframework.web.servlet.DispatcherServlet] (http-11080-1) Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@4268cc6] in DispatcherServlet with name 'report'
[org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] (http-11080-1) No handler mapping found for [/WEB-INF/views/welcome.jsp]
And the contents of WEB-INF/views:
# ls -l WEB-INF/views/welcome.jsp
-rw-r--r-- 1 user group 1.2K 2011-05-24 15:43 WEB-INF/views/welcome.jsp
Why would the container have no problem finding the Spring xml file containing my beans, but not be able to resolve the directory containing my JSPs?