简体   繁体   English

Spring MVC WebAPP可在Eclipse中运行,但在独立的Tomcat中部署时会生成异常

[英]Spring mvc webapp works in eclipse but generates an exception when deployed in standalone tomcat

As said in the title, My application is using SpringMVC and apache Tiles 3. It works fine when run in server in eclipse IDE but when I export a war file and deploy it in the standalone tomcat instance, it deploys Ok but when I access it I have the following exception. 如标题中所述,我的应用程序使用SpringMVC和apache Tiles3。当在eclipse IDE中的服务器中运行时,它运行良好,但是当我导出war文件并将其部署在独立的tomcat实例中时,它会部署Ok,但是当我访问它时我有以下例外。 (Note that the server in eclipse is the same where I deploy my webapp). (请注意,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)

Update : Thanks a lot @Fredlo2010. 更新:非常感谢@ Fredlo2010。 I already saw the link you mentionned 我已经看过您提到的链接

here is my web.xml file 这是我的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>

and the jstl dependency is already in pom.xml file 并且jstl依赖项已经在pom.xml文件中

In one of the answers, one pointed that the project location could be a problem if it contains space and if jetty is combined with apache tiles and spring's view resolver which is not my case. 在其中一个答案中,有人指出,如果项目位置包含空间并且将码头与apache tile和spring的视图解析器结合使用,那么这可能不是问题,这不是我的情况。 However and to eliminate any doubt, I think that I should give it a try. 但是,为了消除任何疑问,我认为我应该尝试一下。 Now I wonder where should I change my project location to a path with no space in it. 现在我想知道应该在哪里将项目位置更改为没有空间的路径。 Any help whould be much appreciable. 任何帮助都是可观的。

what am I doing wrong? 我究竟做错了什么? thank you in advance. 先感谢您。

I can't confirm if it is caused by the space in the project location path but the upgrade from Apache Tiles 3.0.3 to 3.0.5 solved my problem. 我无法确认是否是由项目位置路径中的空格引起的,但是从Apache Tiles 3.0.3升级到3.0.5可以解决我的问题。

Maybe that could help sombody facing the same issue 也许可以帮助某人面对同样的问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring Boot应用程序可以独立运行,但是在Tomcat中部署时找不到类 - Spring Boot application works as standalone but class not found when deployed in Tomcat 404与tomcat / eclipse部署的Webapp - 404 with tomcat / eclipse deployed webapp 我的Web应用程序部署在哪里(从Eclipse到Tomcat 7) - Where is my webapp deployed(From Eclipse to Tomcat 7) 雄猫 在Eclipse中工作,但在部署时不工作 - Tomcat. Works in Eclipse, but does not work when deployed Web应用程序在带有Glassfish 4.1的Eclipse中可以正常工作,但在部署到Tomcat 9时不能正常工作 - Web app works fine in Eclipse with Glassfish 4.1 but not when deployed to Tomcat 9 Spring应用程序在Eclipse中工作,但在tomcat 8上部署时无法正常工作 - Spring application working in eclipse but same not working when deployed on tomcat 8 部署在tomcat上的Spring MVC无法运行 - Spring MVC doesn't run when deployed on tomcat 部署到 Tomcat 时无法访问基本 REST Spring MVC 应用程序 - Basic REST Spring MVC application cannot be reached when deployed to Tomcat 从Spring拦截器打印时HTTP状态错误(0)-在独立TOMCAT中将应用程序部署为WAR时 - Wrong HTTP Status (0) when printing it from a Spring interceptor - When application is deployed as WAR in standalone TOMCAT 我的基于Spring的Restful Web服务在部署到独立的tomcat而不是Eclipse的Tomcat时给出404 - My Spring based Restful webservice gives 404 when deploy to standalone tomcat instead of Eclipse's Tomcat
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM