Procedures

Defines procedures which can be helpful for troubleshooting problems with the application

Find Java install folder

You will need sometimes to use java tools located in java bin folder, which is not always in the PATH.

To find the exact Java bin folder, execute the below command

# ls -l /etc/alternatives/java
> /etc/alternatives/java -> /usr/lib/jvm/java-17-openjdk-17.0.0.0.35-1.rolling.el7.x86_64/bin/java

Find application PID

Java tools often require to provide process PID

It can be discovered by running the below command:

# systemctl status promonitor

The PID is displayed next to the application startup command (22502 in below example)

If multiple PIDs are displayed, run it multiple times, the right one is the one which persists and never changes.

Heap dump

Heap dump creates a file allowing to inspect memory usage of the application
This is helpful for investigating problems such as memory leaks

Get the application PID and run following command

[JAVA BIN PATH]/jmap -dump:live,format=b,file=heapdump.hprof [PID]

Attach the dump file to a ticket. This will help investigating

Note:

If jmaps returns an error such as well-known file /tmp/.java_pid22502 is not secure: file should be owned by the current user (which is 0) but is owned by 994

Try running it by prefixing the command with sudo -u promonitor, such as

sudo -u promonitor [JAVA BIN PATH]/jmap -dump:live,format=b,file=heapdump.hprof [PID]

Stack trace

Stack traces helps understanding what the application is doing at a given time.
This helps investigating performance issues, such as slow startup

Get the application PID and run following command

[JAVA BIN PATH]/jstack PID > stacktrace.log

Attach stacktrace.log to a ticket