<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How can I take a thread dump of Xpert.ivy Server?</title><link>https://answers.axonivy.com/questions/733/how-can-i-take-a-thread-dump-of-xpert-ivy-server</link><description>&lt;p&gt;To analyze deadlocks in my code (and in Xpert.ivy) or endless loops it is useful to get a thread dump.&lt;/p&gt;
&lt;p&gt;The thread dump contains information about each thread, the locks it owns, the locks it is waiting for and the whole java callstack of the thread. A thread dumps looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;"http-8081-8" daemon prio=6 tid=0x000000001cd71000 nid=0x1124 in Object.wait() [0x000000001e24f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on &amp;lt;0x00000004d208fae8&amp;gt; (a org.apache.tomcat.util.net.JIoEndpoint$Worker)
    at java.lang.Object.wait(Object.java:485)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.await(JIoEndpoint.java:458)
    - locked &amp;lt;0x00000004d208fae8&amp;gt; (a org.apache.tomcat.util.net.JIoEndpoint$Worker)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:484)
    at java.lang.Thread.run(Unknown Source)

"http-8081-7" daemon prio=6 tid=0x000000001cd70800 nid=0x1238 in Object.wait() [0x000000001e1cf000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on &amp;lt;0x00000004d2097900&amp;gt; (a org.apache.tomcat.util.net.JIoEndpoint$Worker)
    at java.lang.Object.wait(Object.java:485)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.await(JIoEndpoint.java:458)
    - locked &amp;lt;0x00000004d2097900&amp;gt; (a org.apache.tomcat.util.net.JIoEndpoint$Worker)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:484)
    at java.lang.Thread.run(Unknown Source)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How can I take a thread dump of Xpert.ivy Server?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/733/how-can-i-take-a-thread-dump-of-xpert-ivy-server" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 19 Jun 2023 10:30:12 -0400</lastBuildDate><item><title>Answer by SupportIvyTeam</title><link>https://answers.axonivy.com/questions/733/how-can-i-take-a-thread-dump-of-xpert-ivy-server/4667</link><description>&lt;p&gt;&lt;a href="https://community.axonivy.com/d/148-troubleshoot-endless-loops-and-deadlocks"&gt;https://community.axonivy.com/d/148-troubleshoot-endless-loops-and-deadlocks&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SupportIvyTeam</dc:creator><pubDate>Mon, 19 Jun 2023 10:30:12 -0400</pubDate><guid>https://answers.axonivy.com/questions/733/how-can-i-take-a-thread-dump-of-xpert-ivy-server/4667</guid></item><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/733/how-can-i-take-a-thread-dump-of-xpert-ivy-server/734</link><description>&lt;p&gt;There are multiple ways to take a thread dump:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;JPS and JSTACK&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If the server is not running as Windows Service you can use the command line tools jps and jstack from a Java Developer Kit (JDK). &lt;/p&gt;
&lt;p&gt;First execute jps to see what java virtual maschines are running on your maschine:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt;jps
4384 ServerLauncher
2016
3152 Jps
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then execute jstack with the pid of java virtual maschine executing the ServerLauncher.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt;jstack 4384 &amp;gt;stackdump.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Visual VM&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If the server is not running as Windows Service you can use the Java Developer Kit tool VisualVM&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Execute jvisualvm.exe from the bin
    directory of the JDK.  &lt;/li&gt;
&lt;li&gt;In the
    Applications View search for the
    java virtual maschine (jvm) that is
    running the
    ch.ivyteam.ivy.server.ServerLauncher
    class and double click it.  The jvm
    is opened in a new tab on the left
    side. &lt;/li&gt;
&lt;li&gt;Go the Threads tab and press
    the button Thread Dump. The thread
    dump is created and displayed within
    VisualVM
&lt;img alt="alt text" src="/upfiles/ThreadDumpVisualVm.png"&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Windows Service and Visual VM&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Because a Xpert.ivy Server running as Windows Service is not running with the same user as JPS or VisualVM it is not visible to them because of security reasons. &lt;/p&gt;
&lt;p&gt;However, to take a thread dump of an Xpert.ivy Server running as Windows Service you have to setup Xpert.ivy Server using JMX. Afterwards you can connect with VisualVM to the Xpert.ivy Server running as Windows Service.&lt;/p&gt;
&lt;p&gt;A detailed describtion how to use VisualVM with Xpert.ivy Server running as Windows Service can be found &lt;a href="http://answers.xpertivy.ch/questions/27"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Tue, 03 Jun 2014 12:19:46 -0400</pubDate><guid>https://answers.axonivy.com/questions/733/how-can-i-take-a-thread-dump-of-xpert-ivy-server/734</guid></item></channel></rss>