0 Replies Latest reply on Jul 29, 2004 6:57 AM by csjnr

    Exception after javaagent invoked

    csjnr Newbie

      Hi,
      I'm trying to register a MBean inside a java agent. That is, I run JBoss with the option
      -javaagent=Foo

      where Foo.premain contains

      ManagementFactory.getPlatformMBeanServer().registerMBean(obj, objName);

      By doing that, I get several exceptions, the first of which is:

      12:37:20,590 ERROR [MainDeployer] Initialization failed jboss.system:service=MainDeployer
      org.jboss.util.NestedRuntimeException: Error creating MBeanProxy: jboss.system:type=ServerConfig; - nested throwable: (javax.management.InstanceNotFoundException: jboss.system:type=ServerConfig)
      at org.jboss.mx.util.MBeanProxyExt.(MBeanProxyExt.java:77)
      at org.jboss.mx.util.MBeanProxyExt.create(MBeanProxyExt.java:292)
      at org.jboss.mx.util.MBeanProxyExt.create(MBeanProxyExt.java:247)
      ...

      Is it allowed to use ManagementFactory.getPlatformMBeanServer().registerMBean(...)?
      If not, how could I register my MBean inside the method premain?

      Thanks

      Clovis