2 Replies Latest reply on May 18, 2017 4:57 PM by rcd

    Best way to get thread dump from wildfly running as a Windows service (wildfly-servicexe/ apache procrun)

    milspec

      Hi all,

       

      We're running wildfly 10.1 via  wildfly-service.exe (apache procrun)  windows service wrapper.

       

      What's the easiest way to get a thread dump from wildfly, i.e. when we running as a windows service.

       

      We have not enabled  any 'jmx' on the jvm level, i.e.  -Dcom.sun.management.jmxremote

       

      Can I get a thread dump via jboss-cli.bat?

       

      thanks

        • 1. Re: Best way to get thread dump from wildfly running as a Windows service (wildfly-servicexe/ apache procrun)
          abhijithumbe

          You can use jstack tool which is shipped with JDK. You can use below command:

           

          c:\Java\jdk1.7.0_51\bin\jstack.exe -l Pid >dump.txt

           

          The user executing jstack.exe must be the same user who owns the JVM process or have sufficient privileges to access it (Administrator for example).

          • 2. Re: Best way to get thread dump from wildfly running as a Windows service (wildfly-servicexe/ apache procrun)
            rcd

            I typically use JVisualVM, which is currently shipped as part of the JDK but apparently will be separate starting with JDK 9.

             

            There are two fairly easy ways to connect JVisualVM to WF when WF is running as a service.

             

            1) Configure the service to log on as some user account instead of as the Local System account. Then if you log on to the machine using the same account, the WF process will be visible.

             

            2) WF exposes JMX over its HTTP port, unless you've changed your WF config to stop it from doing that. You can use this to access WF running as any user.

            Start JVisualVM with the cli-client JAR on the classpath:

            jvisualvm --cp:a $WFLY\bin\client\jboss-cli-client.jar

            Then go to File -> Add JMX Connection. In the connection field, enter:

            service:jmx:remote+http://localhost:$PORT
            where $PORT is the port defined in the WildFly configuration file for the management-http socket-binding (9990 by default).