• 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"

  • 相关阅读:
    QDir路径的测试与创建-QT
    QGridLayout--01
    第42月第18天 iOS匹配特殊字符 markedTextRange
    第42月15天 framework静态库依赖framework静态库
    第42月第13天 top命令 load average dispatch_group
    第42月第11天 curl post 预约码设计
    第42月第5天 vux 5大功能
    第42月第5天 Swift Playgrounds Mac 版上线 app强制更新
    第42月第4天 Xcode11 打包失败 IPA processing failed
    第42月第3天 PlatformVersionAtLeast armv7 armv7s arm64 podspec icon在线
  • 原文地址:https://www.cnblogs.com/wzbury/p/14081425.html
Copyright © 2020-2023  润新知