質問

I'm trying to make an Mbeans which can change a few parameters in runtime but when trying to invoke an operation the following error occurs:

java.rmi.UnmarshalException: Error unmarshaling return; nested exception is: java.lang.ClassNotFoundException: weblogic.management.NoAccessRuntimeException > (no security manager: RMI class loader disabled)

I am using weblogic y jconsole.

code:

 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;
    }
  }
役に立ちましたか?

解決

If you put Weblogic's JARs in your classpath it should work or at least you will get rid of the ClassNotFoundException

I would put weblogic.jar or wlfullclient.jar (if you have it), try running JConsole in a way similar to this:

jconsole -J-Djava.class.path="Weblogic Lib Folder\weblogic.jar"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top