Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用JAMon,我想使用jamon.war来监控我的应用程序。但是,我的应用程序和jamon.war应用程序具有不同的类加载器,因此它们看不到彼此的静态变量(据我所知,数据存储在哪里)。当我调用MonitorFactory.getReport()我的应用程序时,我得到了正确的数据。
jamon.war
MonitorFactory.getReport()
如何让这个工作?
问题是我的 .jar 文件中有 jamon-xx.jar WEB-INF/lib。当我删除它(并且只在 tomcat 的 lib 目录中)时,它由 tomcat 类加载器(我猜它是所有应用程序类加载器的父级)加载,因此两个应用程序可以共享静态字段。
WEB-INF/lib