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"

  • 相关阅读:
    竞争冒险及其消除
    [C++]重复单词统计
    [C++]智能指针与常规new
    基于go的生产者消费者模型
    cin的返回对象
    为什么map对象不能使用stl中的sort函数
    opencv
    operator ->
    记一次源码分析
    iconfig1
  • 原文地址:https://www.cnblogs.com/wzbury/p/14081425.html
Copyright © 2011-2022 走看看