jvm - JMX 和不同的类加载器
问题描述
我的项目是多模块的,结构如下:
- 通用(JMX MBean 接口)。
- 代理(JMX MBean 实现和检测代码 - 我在这里注册了 MBean)
- 插件(这里我“询问”注册的 MBean)
问题是插件部分使用与代理不同的类加载器。因此我收到
java.lang.ClassCastException: class com.github.lppedd.jmx.FeaturesMBean$Feature cannot be cast to class com.github.lppedd.jmx.FeaturesMBean$Feature
(com.github.lppedd.jmx.FeaturesMBean$Feature is in unnamed module of loader 'app';
com.github.lppedd.jmx.FeaturesMBean$Feature is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @35962a94)
被指控的 MBean 是
public interface FeaturesMBean {
List<Feature> availableFeatures();
class Feature implements Serializable {
private static final long serialVersionUID = 1L;
public final String name;
public final String description;
public Feature(final String name, final String description) {
this.name = name;
this.description = description;
}
}
}
我应该如何处理这个问题?
解决方案
推荐阅读
- javascript - 尝试使用间隔更改 React Hooks 中的状态
- javascript - Paypal 付费墙自定义文本 css
- python - 不处理词云停用词
- sql - Redshift 跳过 split_part() 的第一个字符
- javascript - Formik 的表单无法识别 Material UI 组件的文本字段值?
- r - 以编程方式循环列表
- django - 异常值:__init__() 得到了一个意外的关键字参数“limit_choices_to”
- python-3.x - 显示饼图图例,不显示条形图图例,仅更改为图形类型
- c# - 获取两个日期之间的周期
- c++ - 带有用户输入的字符串金字塔