0 Replies Latest reply on Dec 29, 2016 6:19 AM by Mylos Kathos

    java.lang:type=MemoryPool not available

    Mylos Kathos Master

      Hi all,

      I'd need to use the MemoryPoolMXBean in order to set a threshold on the memory usage of WildFly 10. I'm using the following code to acquire the MemoryPoolMXBean from a MBeanServerConnection:

      final MBeanServerConnection remote
              = connector.getMBeanServerConnection();
      
      final MemoryPoolMXBean pool
              = ManagementFactory.newPlatformMXBeanProxy(
                      remote,
                      ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE,
                      MemoryPoolMXBean.class);
      pool.setUsageThreshold(50);
      

       

      The problem is that, once connected, it seems that the MemoryPool MemoryPoolMXBean is not registered:

       

      INFO: JBoss Remoting version 4.0.21.Final
      Connected to MBean Server
      Exception in thread "main" java.lang.IllegalArgumentException: javax.management.InstanceNotFoundException: java.lang:type=MemoryPool
          at java.lang.management.ManagementFactory.newPlatformMXBeanProxy(ManagementFactory.java:630)
          at browse.Monitor.connect(Monitor.java:38)
          at browse.Monitor.main(Monitor.java:82)
      Caused by: javax.management.InstanceNotFoundException: java.lang:type=MemoryPool
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.isInstanceOf(DefaultMBeanServerInterceptor.java:1401)
          at com.sun.jmx.mbeanserver.JmxMBeanServer.isInstanceOf(JmxMBeanServer.java:1091)
          at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.isInstanceOf(PluggableMBeanServerImpl.java:1510)
          at org.jboss.as.jmx.PluggableMBeanServerImpl.isInstanceOf(PluggableMBeanServerImpl.java:746)
          at org.jboss.as.jmx.BlockingNotificationMBeanServer.isInstanceOf(BlockingNotificationMBeanServer.java:256)
          at org.jboss.remotingjmx.protocol.v2.ServerProxy$InstanceofHandler.handle(ServerProxy.java:858)
          at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1$1.run(ServerCommon.java:153)
          at org.jboss.as.jmx.ServerInterceptorFactory$Interceptor$1.run(ServerInterceptorFactory.java:75)
          at org.jboss.as.jmx.ServerInterceptorFactory$Interceptor$1.run(ServerInterceptorFactory.java:70)
          at java.security.AccessController.doPrivileged(Native Method)
          at javax.security.auth.Subject.doAs(Subject.java:422)
          at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:149)
          at org.jboss.as.jmx.ServerInterceptorFactory$Interceptor.handleEvent(ServerInterceptorFactory.java:70)
          at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1.run(ServerCommon.java:149)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
      

      I've tried with other MXBeans (such as RuntimeMXBean) and I'm able to access its information. Only this one seems not to be available.

      Any idea how to solve this issue?

      thanks

      Mylos