zoukankan      html  css  js  c++  java
  • Illegal access: this web application instance has been stopped already. Could not load net.sf.ehcache.store.compound.Segment$1.

    异常信息:
    The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException

    回答:

    当你停止你的应用程序时,看看tomcat日志是否有警告:严重:web应用程序[/APP]似乎已经启动了一个名为[Ehcache Worker-1]的线程,但未能停止它。这很可能会造成内存泄漏如果发现类似的东西,你应该在你的ServletContextListener中停止ecache:
    public void contextDestroyed(ServletContextEvent).shutdown0 CacheManager.getInstance);
    也许在那之后有1秒休眠,以确保ehcache被停止。正如在http://ehcache.org/documentation/fag中提到的是一种持续状态,在下一次它们被使用时,如果空调不关闭,就不应该是一个问题。他在虚拟机上颤抖。或者您可以在ehcache.xml中设置属性overflowToDisk="false",或者在每次部署应用程序时重新启动tomcat。

    大体含义是,有个ehcache线程在服务器重启或关闭时应该关闭,但没有成功关闭。这个线程可能会造成内存泄漏。
    Tomcat关闭日志如下:

    十二月 03, 2020 4:58:41 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
    严重: The web application [] appears to have started a thread named [net.sf.ehcache.CacheManager@3d1c414e] but has failed to stop it. This is very likely to create a memory leak.
    

    解决方式一:
    将tomcat中的server.xml中的reloadable由原来的true改为false。
    设置reloadable="true"后,tomcat会实时的监控项目的源码,一旦出现改动会自己重启tomcat服务器。在调试程序的时候一般都不会设置relaodable="true",频繁的重启tomcat是不合理的。如果你设置了reloadable="false",或者没有设置这个属性,只有当你在添加,删除,重命名方法或实例字段的时候才要求服务重启,适合你调试程序。
    就是先关Tomcat,然后再启,不要热启动。
    解决方式二:
    在ehcache.xml中设置属性overflowToDisk="false"

  • 相关阅读:
    centos、mac的grafana安装和简单使用
    通过k8s(Kubernetes)搭建jmeter的压测环境master-slave架构,实现弹性伸缩
    burpsuite破解版
    jvm调优
    火狐firefox、谷歌chrome等浏览器扩展、插件介绍
    关于Chrome谷歌浏览器开发者工具网络Network中返回无数据的问题
    微博登录过程分析
    SQL SERVER大话存储结构(4)_复合索引与包含索引
    千万级别数据表,单列索引和多列索引性能对比
    Showplan 逻辑运算符和物理运算符参考
  • 原文地址:https://www.cnblogs.com/wzbury/p/14081425.html
Copyright © 2011-2022 走看看