2

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;
    }
  }
Oxxi
  • 45
  • 9
  • Can we see your code, pls ? – Brian Agnew Oct 13 '13 at 16:46
  • public class MyMonitor implements MyMonitorMBean { private String _con; @Override public synchronized void setMessage(String msg) { _con = msg; } – Oxxi Oct 13 '13 at 18:16
  • not sure if weblogic has special jmx support, but do you need to annotate your MyMonitorBean interface with something like `@MXBean`? – jtahlborn Oct 13 '13 at 20:36
  • Have you checked the other answers on this site like: http://stackoverflow.com/questions/6322107/java-no-security-manager-rmi-class-loader-disabled http://stackoverflow.com/questions/7178137/java-rmi-serverexception-no-security-manager-rmi-class-loader-disabled http://stackoverflow.com/questions/17351336/i-am-running-a-rmi-application-and-no-security-manager-rmi-class-loader-disable – Display Name is missing Oct 14 '13 at 15:11

1 Answers1

0

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"
Rafael Oltra
  • 1,239
  • 9
  • 15