Problem

In order to troubleshoot performance issues it is often useful to identify the java process for the semarchy server

Solution

The first step is to identify the java process running the applicaiton server. The way to identify the process will depend on the os and application server.

Using jps tool

jps is a command line tool bundled with the jdk.

It can be found in <JDK_HOME>/bin/jps.

It can be used to list running java processes using jps -vl

For instance:

  • to list all java processes you can use jps -vl
  • to list tomcat process you can use jps -vl | grep -v grep | grep org.apache.catalina.startup.Bootstrap

Those commands will output one line per java process. A line looks something like this.

4415 org.apache.catalina.startup.Bootstrap -Djava.util.logging.config.file=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Xmx512m -XX:+UseG1GC -Dorg.ops4j.pax.logging.DefaultServiceLog.level=WARN -Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Slf4jLogger -Duser.language=en -Duser.country=US -Djava.endorsed.dirs=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server/endorsed -Dcatalina.base=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server -Dcatalina.home=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server -Djava.io.tmpdir=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server/temp

The process id is the first value on the line (4415 in the above example)

Using os specific tools

On Microsoft Windows

On Windows you can use the task manager.

On Linux

On Linux you can use the ps command-line tool.

For instance:

  • to list all java processes you can use ps -elf | grep -v grep | grep java
  • to list tomcat process you can use ps -elf | grep -v grep | grep org.apache.catalina.startup.Bootstrap

Those commands will output one line per matching process. A line looks something like this

0 S sarod 4415 30134 5 80 0 - 1550630 futex_ 09:50 pts/1 00:00:22 /home/sarod/.sdkman/candidates/java/current/bin/java -Djava.util.logging.config.file=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Xmx512m -server -XX:+UseG1GC -Dorg.ops4j.pax.logging.DefaultServiceLog.level=WARN -Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Slf4jLogger -Duser.language=en -Duser.country=US -Djava.endorsed.dirs=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server/endorsed -classpath /home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server/bin/bootstrap.jar:/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server/bin/tomcat-juli.jar -Dcatalina.base=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server -Dcatalina.home=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server -Djava.io.tmpdir=/home/sarod/dev/QA/4.2.0.ga/semarchy-xdm-preconfigured-4.2.0.ga-20171013-0950/mdm-server/temp org.apache.catalina.startup.Bootstrap start

The process id is the 4th value (4415 in the above example)