如标题中所述,我的应用程序正在使用SpringMVC和apache Tiles 3.它在eclipse IDE中的服务器中运行时工作正常但是当我导出war文件并将其部署在独立的tomcat实例中时,它会部署Ok但是当我访问它我有以下例外。 (请注意,eclipse中的服务器与我部署webapp的位置相同)。
> exception
>
> javax.servlet.ServletException: Could not resolve view with name
> 'login' in servlet with name 'dispatcher'
> org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
> org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1012)
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
> org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
> org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
> org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
更新:非常感谢@ Fredlo2010。我已经看到了你提到的链接
这是我的web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>Project</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
并且jstl依赖项已经在pom.xml文件中
在其中一个答案中,有人指出,如果项目位置包含空间,并且如果jetty与apache tile和spring的视图解析器相结合,那么项目位置可能会出现问题。然而,为了消除任何疑问,我认为我应该试一试。现在我想知道在哪里可以将项目位置更改为没有空格的路径。任何帮助都会非常明显。
我做错了什么?提前谢谢你。答案 0 :(得分:0)
我无法确认它是否是由项目位置路径中的空间引起的,但是从Apache Tiles 3.0.3升级到3.0.5解决了我的问题。
也许这可以帮助sombody面对同样的问题