Java Mission Control (JMC) 无法更改 MBean 属性

问题描述 投票:0回答:1

我无法更改 JMC (v 7.1)、jdk1.8.0_172 中注册的 MBean 的属性

但是,我可以在 jconsole

中更改它

MBean 定义和注册:

public class ProfilingController implements ProfilingControllerMBean {
    private boolean enabled = false;

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }
}

public interface ProfilingControllerMBean {
    void setEnabled(boolean enabled);
}


ManagementFactory.getPlatformMBeanServer().registerMBean(controller, new ObjectName("AppProfiling", "name", "ProfilingController"));
java jmx mbeans jmc
1个回答
0
投票

我遇到了同样的问题。我使用java 21,JDK Mission Control 8.3.1+b05 enter image description here 我注意到错误消息“无法找到已启用的属性”,并决定向界面添加一个 get 方法,一切正常。 enter image description here enter image description here 也许某个地方有 MBean 约定的描述,并且那里描述了所有内容。 enter image description here 我希望它对某人有用。

© www.soinside.com 2019 - 2024. All rights reserved.