0
我試圖讓可以改變在運行的幾個參數的Mbean的,但試圖調用時出現以下錯誤的操作時:的MBean operaciones錯誤的Weblogic
java.rmi.UnmarshalException: Error unmarshaling return; nested exception is: java.lang.ClassNotFoundException: weblogic.management.NoAccessRuntimeException > (no security manager: RMI class loader disabled)
我使用WebLogicÿJConsole的。
代碼:
public class MyMBeanListener extends ApplicationLifecycleListener {
public void postStart(weblogic.application.ApplicationLifecycleEvent p1) {
try {
ObjectName mymbean =
new ObjectName("monitor:Name=MyMonitor,Type=MyMonitorMBean");
InitialContext ctx = new InitialContext();
MBeanServer server = (MBeanServer)ctx.lookup("java:comp/jmx/runtime");
MyMonitor monitor = new MyMonitor();
server.registerMBean(monitor, mymbean);
System.out.println(" MBean registered successfully!");
} catch (Exception e) {
e.printStackTrace();
}
}
public interface MyMonitorMBean {
public void setMessage(String msg);
}
public class MyMonitor implements MyMonitorMBean {
private String _con;
@Override
public synchronized void setMessage(String msg) {
_con = msg;
}
}
我們可以看到你的代碼嗎? –
public class MyMonitor implements MyMonitorMBean {private String _con; @Override public synchronized void setMessage(String msg){_con = msg; } – Oxxi
不確定weblogic是否有特殊的jmx支持,但是你需要用'@MXBean'來註釋MyMonitorBean接口嗎? – jtahlborn