0 Replies Latest reply on Mar 19, 2013 6:08 AM by ken zheng

    How to do dumpAllThreads in jboss as7 by remote JMX Programe

    ken zheng Newbie

      I can connect the remote/local jboss sever by using %JBOSS_HOME%/bin/jconsole.bat. In jconsole , I can do dumpAllThreads operation and get the right result.

      However , when I use java code with the MBeanServerConnection interface to dumpAllThreads(boolean,boolean)  or getThreadInfo(long[], boolean, boolean), I got Exception:

      The java code is :
           MBeanServerConnection scon = con.getMBeanServerConnection();

           ObjectName oname = new ObjectName(ManagementFactory.THREAD_MXBEAN_NAME);

           Object obj = scon.invoke(oname, "dumpAllThreads", new Object[]{true,false}, new String[]{"java.lang.String","java.lang.String"});

      or

           ThreadMXBean mx = ManagementFactory.newPlatformMXBeanProxy(scon,ManagementFactory.THREAD_MXBEAN_NAME, ThreadMXBean.class);

           ThreadInfo[] txx = mx.dumpAllThreads(true, false);

       

      Exception:

      Exception in thread "main" java.lang.RuntimeException: Operation failed with status WAITING

          at org.jboss.remoting3.jmx.RemotingConnector.connect(RemotingConnector.java:155)

          at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:267)

       

      Environment

           jboss as7,jdk7

       

      NOTE

          ThreadInfo t = mx.getThreadInfo(l,200)  and any other mxbean such as MemoryPoolMXBean will be ok.

       

      Do you have this kind of situation?

      If any other configurations should be done before jmx in jboss as7?

      Thanks you in advance.