码迷,mamicode.com
首页 > 编程语言 > 详细

记SpringBoot项目长时间未访问,出现页面找不到的问题

时间:2019-10-18 18:42:59      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:ldo   tps   not   dos   信息   pac   报错   cat   col   

最近某个开发环境的某个应用,隔三差五出现了某某页面找不到,网上百度找了些同类的问题都是说jstl包与默认tomcat里的包冲突,但都感觉和我的问题不是很搭配(因为相同框架的其他项目都可以正常允许)
  1. 报错信息如下:
    17:40:18.890 [http-nio-8088-exec-18] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.view.jsp.poi.detail_jsp] with root cause
    java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.view.jsp.xxx_jsp
            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
            at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:129)
            at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:60)
            at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:128)
            at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:380)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:112)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728)
            at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:467)
            at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:392)
            at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
            at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
            at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
            at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286)
            at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041)
            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984)
            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
            at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
            at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  2. 原因
    说真的,起初一看到这样的问题,脑海里直接就闪出一个答案,服务器打的包有问题,但是隔三差五出现这样的问题,就开始怀疑真的是包问题?
    经验证并不是!!!!!!!!!!
    
    每当出现这样的问题,我都会重新打个包到线上,嗯,报错找不到的页面可以访问了,但是隔了和多天发现另外一个页面同样的问题;这个时候开始认真起来了,开始了百度寻找难兄难弟,一百度发现全是说的是包冲突;
    
    我检查了一遍包发现并没有那样的冲突,我猜是不是服务器的问题,我就重启了一下项目,这个时候之前报错的页面可以访问了。。。基本确定是和服务器有关!

    真正的原因

    有多少小伙伴知道springboot项目运行的项目解压文件在哪? 如果未自定义默认在/tmp文件夹下生成tomcat.xxxx文件,而linux有删除策略会删除临时文件
    项目编译文件地址

    技术图片

    为了保证tmp目录不爆满,linux服务器会自动删除一些长时间不访问的一些编译文件(具体怎么删不是很清楚),如果长达10天未访问的临时文件会被linux删除掉!!
    
    现在想想开发环境的这个项目经常很长时间没人访问,也没有自定义过编译文件目录,已经可以肯定就是这个问题导致的
  3. 解决方法

    在springboot的配置文件中增加配置,增加配置tomcat.basedir的路径
    
    server:
      port: 8088
      tomcat:
        basedir: /usr/local/tmp

    总结

    感谢道友!!!
    原文:https://www.liangzl.com/get-article-detail-133406.html
    切换了临时目录的小伙伴也需要时常去检查下新的目录下的编译文件的大小哦,及时删除!别过了很长时间导致撑爆了内存
    
    经常在项目中遇到各种各样的千奇百怪的问题, 怎么解决的、为什么还是要记录下来,因为你不知道啥时候又遇到了!!!

记SpringBoot项目长时间未访问,出现页面找不到的问题

标签:ldo   tps   not   dos   信息   pac   报错   cat   col   

原文地址:https://www.cnblogs.com/hetangyuese/p/11700033.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!