ServletException:JSP 在 AWS bitnami Tomcat 8.5 上的三次尝试中找不到一次文件
ServletException: JSP file not found once in three attempts on AWS bitnami Tomcat 8.5
两个 WAR 是从同一提交构建的,但不是同一天。 6 月 15 日的版本已部署在 AWS 上(bitnami Tomcat8.5 映像)并且运行良好。 6 月 23 日的版本在部署时显示 javax.servlet.ServletException 表示未找到文件 /WEB-INF/jsp/view/home.jsp。但是,它位于已部署的 WAR 中。当尝试访问 home.jsp 页面时,有 1/3 的时间页面会抛出错误。其他两次都没问题。这只发生在 JSP 而不是 Thymeleaf 页面。我将 WAR 与 BeyondCompare 软件进行了比较:除了 git.properties 中的构建日期时间外,它们是相同的。我想也许服务器上发生了一些变化。但是当我放回 6 月 15 日的版本时,它再次完美运行!
这是堆栈跟踪:
23-06-2021 06:07:16.054 [http-nio-8080-exec-29] 信息 c.i.i.controller.HomeController - 请求主页
23-06-2021 06:07:16.058 [http-nio-8080-exec-29] 调试 c.i.i.controller.HomeController - home= 区域
23-06-2021 06:07:16.060 [http-nio-8080-exec-29] 调试 c.i.i.service.impl.RegionServiceImpl - 找不到 name= 的区域
23-06-2021 06:07:16.063 [http-nio-8080-exec-29] 调试 c.i.i.s.impl.VehicleServiceImpl - 使用 useFeatured=true 查找车辆
23-06-2021 06:07:16.089 [http-nio-8080-exec-29] 调试 c.i.i.service.impl.RegionServiceImpl - 找不到 name= 的区域
23-06-2021 06:07:16.176 [http-nio-8080-exec-29] 错误 o.s.b.w.s.support.ErrorPageFilter - 由于异常 [java.io.IOException,从请求 [/] 转发到错误页面:JSP异常包括路径'/WEB-INF/jsp/view/home.jsp'。]
org.apache.tiles.request.render.CannotRenderException: java.io.IOException: JSP异常包括路径'/WEB-INF/jsp/view/home.jsp'。
在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:399)
在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
在 org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)
在 org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:147)
在 org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)
在 org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1393)
在 org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1138)
在 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1077)
在 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962)
在 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
在 org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
在 javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
在 org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
在 javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
在 org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
在 org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:218)
在 org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
在 org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:117)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
在 org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
在 org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
在 org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
在 org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
在 org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
在 org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:126)
在 org.springframework.boot.web.servlet.support.ErrorPageFilter.access000 美元(ErrorPageFilter.java:64)
在 org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:101)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
在 org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:119)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544)
在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
在 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
在 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:616)
在 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
在 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818)
在 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1626)
在 org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
在 java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
在 java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
在 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
在 java.base/java.lang.Thread.run(Thread.java:834)
由以下原因引起:java.io.IOException:java.io.IOException:JSP异常,包括路径“/WEB-INF/jsp/view/home.jsp”。
在 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:504)
在 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
在 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
在 javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:713)
在 org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:462)
在 org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:387)
在 org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:315)
在 org.springframework.security.web.header.HeaderWriterFilter$HeaderWriterRequestDispatcher.forward(HeaderWriterFilter.java:171)
在 org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
在 org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
在 org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
在 org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
... 省略了 96 个公共框架
由以下原因引起:java.io.IOException:JSP异常包括路径“/WEB-INF/jsp/view/home.jsp”。
在 org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:63)
在 org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:125)
在 org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47)
在 org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
在 org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68)
在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
在 org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188)
在 org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132)
在 org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)
在 org.apache.jsp.WEB_002dINF.jsp.layout.default_002dlayout_jsp._jspx_meth_tiles_005finsertAttribute_005f1(default_002dlayout_jsp.java:751)
在 org.apache.jsp.WEB_002dINF.jsp.layout.default_002dlayout_jsp._jspService(default_002dlayout_jsp.java:212)
在 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
在 javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
在 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
...省略了 124 个公共帧
原因:javax.servlet.ServletException: JSP 找不到文件 [/WEB-INF/jsp/view/home.jsp]
在 org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:407)
在 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:388)
在 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
在 javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)
在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:713)
在 org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:583)
在 org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:519)
在 org.springframework.security.web.header.HeaderWriterFilter$HeaderWriterRequestDispatcher.include(HeaderWriterFilter.java:177)
在 org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:865)
在 org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:679)
在 org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:673)
在 org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123)
...省略了 136 个公共帧
这是 pom.xml:
</p>
<pre><code><parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.icimedia</groupId>
<artifactId>ici-autos</artifactId>
<version>2.2.0</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<mapstruct.version>1.3.1.Final</mapstruct.version>
<org.projectlombok.version>1.18.12</org.projectlombok.version>
<!-- Apache Tiles -->
<tiles.version>3.0.8</tiles.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!-- configuration processor to generate configuration metadata -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<scope>provided</scope>
</dependency>
<!-- Tomcat embedded container-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- JSTL for JSP -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<!-- <scope>provided</scope> -->
</dependency>
<!-- Need this to compile JSP -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!-- Need this to compile JSP,
tomcat-embed-jasper version is not working, no idea why -->
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.6.1</version>
<scope>provided</scope>
</dependency>
<!-- Apache Tiles dependencies -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-api</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
</dependency>
<!-- FTP client -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.7.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
</dependencies>
<build>
<finalName>iciautos</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<!-- For JPA static metamodel generation -->
<path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.projectlombok.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amapstruct.suppressGeneratorTimestamp=true</arg>
<arg>-Amapstruct.defaultComponentModel=spring</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/annotations</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<dateFormat>yyyyMMdd-HHmmss</dateFormat><!-- human-readable part of the version number -->
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<offline>true</offline>
</configuration>
</plugin>
</plugins>
</build>
我找到了这个奇怪的间歇性问题的解决方案。它与清除已编译 JSP 的 Tomcat 缓存有关。
如 this post 中所述,
JSP 在 /opt/bitnami/tomcat/work/Catalina/localhost 中编译。所以我们要删除这个缓存,但是先停止 Tomcat :
sudo /opt/bitnami/ctlscript.sh stop tomcat
然后删除缓存:
sudo rm -rf /opt/bitnami/tomcat/work/Catalina/localhost/iciautos
然后删除应用并复制新的:
sudo rm -rf /opt/bitnami/tomcat/webapps/iciautos
sudo rm -rf /opt/bitnami/tomcat/webapps/iciautos.war
sudo cp iciautos.war /opt/bitnami/tomcat/webapps/
然后重启
sudo /opt/bitnami/ctlscript.sh start tomcat
已修复!
两个 WAR 是从同一提交构建的,但不是同一天。 6 月 15 日的版本已部署在 AWS 上(bitnami Tomcat8.5 映像)并且运行良好。 6 月 23 日的版本在部署时显示 javax.servlet.ServletException 表示未找到文件 /WEB-INF/jsp/view/home.jsp。但是,它位于已部署的 WAR 中。当尝试访问 home.jsp 页面时,有 1/3 的时间页面会抛出错误。其他两次都没问题。这只发生在 JSP 而不是 Thymeleaf 页面。我将 WAR 与 BeyondCompare 软件进行了比较:除了 git.properties 中的构建日期时间外,它们是相同的。我想也许服务器上发生了一些变化。但是当我放回 6 月 15 日的版本时,它再次完美运行! 这是堆栈跟踪:
23-06-2021 06:07:16.054 [http-nio-8080-exec-29] 信息 c.i.i.controller.HomeController - 请求主页 23-06-2021 06:07:16.058 [http-nio-8080-exec-29] 调试 c.i.i.controller.HomeController - home= 区域 23-06-2021 06:07:16.060 [http-nio-8080-exec-29] 调试 c.i.i.service.impl.RegionServiceImpl - 找不到 name= 的区域 23-06-2021 06:07:16.063 [http-nio-8080-exec-29] 调试 c.i.i.s.impl.VehicleServiceImpl - 使用 useFeatured=true 查找车辆 23-06-2021 06:07:16.089 [http-nio-8080-exec-29] 调试 c.i.i.service.impl.RegionServiceImpl - 找不到 name= 的区域 23-06-2021 06:07:16.176 [http-nio-8080-exec-29] 错误 o.s.b.w.s.support.ErrorPageFilter - 由于异常 [java.io.IOException,从请求 [/] 转发到错误页面:JSP异常包括路径'/WEB-INF/jsp/view/home.jsp'。] org.apache.tiles.request.render.CannotRenderException: java.io.IOException: JSP异常包括路径'/WEB-INF/jsp/view/home.jsp'。 在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:399) 在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238) 在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221) 在 org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59) 在 org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:147) 在 org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316) 在 org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1393) 在 org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1138) 在 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1077) 在 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) 在 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) 在 org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:626) 在 org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) 在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) 在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) 在 org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) 在 org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:218) 在 org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) 在 org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:117) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) 在 org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) 在 org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) 在 org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) 在 org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) 在 org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) 在 org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:126) 在 org.springframework.boot.web.servlet.support.ErrorPageFilter.access000 美元(ErrorPageFilter.java:64) 在 org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:101) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:119) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) 在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544) 在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) 在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) 在 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690) 在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) 在 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:616) 在 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) 在 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818) 在 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1626) 在 org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) 在 java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 在 java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 在 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 在 java.base/java.lang.Thread.run(Thread.java:834) 由以下原因引起:java.io.IOException:java.io.IOException:JSP异常,包括路径“/WEB-INF/jsp/view/home.jsp”。 在 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:504) 在 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) 在 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:713) 在 org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:462) 在 org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:387) 在 org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:315) 在 org.springframework.security.web.header.HeaderWriterFilter$HeaderWriterRequestDispatcher.forward(HeaderWriterFilter.java:171) 在 org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265) 在 org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228) 在 org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57) 在 org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47) 在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259) 在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397) ... 省略了 96 个公共框架 由以下原因引起:java.io.IOException:JSP异常包括路径“/WEB-INF/jsp/view/home.jsp”。 在 org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:63) 在 org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:125) 在 org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47) 在 org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47) 在 org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68) 在 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259) 在 org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188) 在 org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132) 在 org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299) 在 org.apache.jsp.WEB_002dINF.jsp.layout.default_002dlayout_jsp._jspx_meth_tiles_005finsertAttribute_005f1(default_002dlayout_jsp.java:751) 在 org.apache.jsp.WEB_002dINF.jsp.layout.default_002dlayout_jsp._jspService(default_002dlayout_jsp.java:212) 在 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 在 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476) ...省略了 124 个公共帧 原因:javax.servlet.ServletException: JSP 找不到文件 [/WEB-INF/jsp/view/home.jsp] 在 org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:407) 在 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:388) 在 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:713) 在 org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:583) 在 org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:519) 在 org.springframework.security.web.header.HeaderWriterFilter$HeaderWriterRequestDispatcher.include(HeaderWriterFilter.java:177) 在 org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:865) 在 org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:679) 在 org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:673) 在 org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123) ...省略了 136 个公共帧
这是 pom.xml:
</p>
<pre><code><parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.icimedia</groupId>
<artifactId>ici-autos</artifactId>
<version>2.2.0</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<mapstruct.version>1.3.1.Final</mapstruct.version>
<org.projectlombok.version>1.18.12</org.projectlombok.version>
<!-- Apache Tiles -->
<tiles.version>3.0.8</tiles.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!-- configuration processor to generate configuration metadata -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<scope>provided</scope>
</dependency>
<!-- Tomcat embedded container-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- JSTL for JSP -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<!-- <scope>provided</scope> -->
</dependency>
<!-- Need this to compile JSP -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!-- Need this to compile JSP,
tomcat-embed-jasper version is not working, no idea why -->
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.6.1</version>
<scope>provided</scope>
</dependency>
<!-- Apache Tiles dependencies -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-api</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
</dependency>
<!-- FTP client -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.7.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
</dependencies>
<build>
<finalName>iciautos</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<!-- For JPA static metamodel generation -->
<path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.projectlombok.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amapstruct.suppressGeneratorTimestamp=true</arg>
<arg>-Amapstruct.defaultComponentModel=spring</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/annotations</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<dateFormat>yyyyMMdd-HHmmss</dateFormat><!-- human-readable part of the version number -->
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<offline>true</offline>
</configuration>
</plugin>
</plugins>
</build>
我找到了这个奇怪的间歇性问题的解决方案。它与清除已编译 JSP 的 Tomcat 缓存有关。
如 this post 中所述, JSP 在 /opt/bitnami/tomcat/work/Catalina/localhost 中编译。所以我们要删除这个缓存,但是先停止 Tomcat :
sudo /opt/bitnami/ctlscript.sh stop tomcat
然后删除缓存:
sudo rm -rf /opt/bitnami/tomcat/work/Catalina/localhost/iciautos
然后删除应用并复制新的:
sudo rm -rf /opt/bitnami/tomcat/webapps/iciautos
sudo rm -rf /opt/bitnami/tomcat/webapps/iciautos.war
sudo cp iciautos.war /opt/bitnami/tomcat/webapps/
然后重启
sudo /opt/bitnami/ctlscript.sh start tomcat
已修复!