To analyze deadlocks in my code (and in Xpert.ivy) or endless loops it is useful to get a thread dump.

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:

"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 <0x00000004d208fae8> (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 <0x00000004d208fae8> (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 <0x00000004d2097900> (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 <0x00000004d2097900> (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)

How can I take a thread dump of Xpert.ivy Server?

asked 03.06.2014 at 12:15

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
4.2k172450
accept rate: 73%


There are multiple ways to take a thread dump:

JPS and JSTACK

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).

First execute jps to see what java virtual maschines are running on your maschine:

>jps
4384 ServerLauncher
2016
3152 Jps

Then execute jstack with the pid of java virtual maschine executing the ServerLauncher.

>jstack 4384 >stackdump.txt

Visual VM

If the server is not running as Windows Service you can use the Java Developer Kit tool VisualVM

  1. Execute jvisualvm.exe from the bin directory of the JDK.
  2. 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.
  3. Go the Threads tab and press the button Thread Dump. The thread dump is created and displayed within VisualVM alt text

Windows Service and Visual VM

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.

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.

A detailed describtion how to use VisualVM with Xpert.ivy Server running as Windows Service can be found here.

link

answered 03.06.2014 at 12:19

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
4.2k172450
accept rate: 73%

edited 31.07.2014 at 14:27

Christian%20Strebel's gravatar image

Christian St... ♦
2.5k21028

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6

Asked: 03.06.2014 at 12:15

Seen: 3,298 times

Last updated: 31.07.2014 at 14:27