0

When I launch jcmd it shows me all java processes except Jetty, why?

JCmd:

[root@test_app_bm 2015_06_01_18_19_47_13098]# /usr/java/latest/bin/jcmd 
15152 sun.tools.jcmd.JCmd
21785 DummyTrkPartner.jar

Ps aux:

[root@test_app_bm 2015_06_01_18_19_47_13098]# ps aux | grep java
jetty    13098 13.8 74.4 7048352 2957192 ?     Sl   18:19   4:29 /usr/java/latest/bin/java -Xmx1800m -Xms256m -XX:+UseG1GC -Dhttps.proxyHost=1.1.1.1 -Dhttps.proxyPort=3128 -Dhttp.proxyHost=1.1.1.1 -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=localhost -Djetty.logs=/usr/local/jetty/logs -Djetty.home=/usr/local/jetty -Djetty.base=/usr/local/jetty -Djava.io.tmpdir=/usr/local/jetty/work -jar /usr/local/jetty/start.jar jetty.state=/usr/local/jetty/work/jetty.state jetty-logging.xml jetty-started.xml start-log-file=/usr/local/jetty/logs/start.log
root     15165  0.0  0.0 103244   864 pts/0    S+   18:52   0:00 grep java
root     21785  0.1  2.4 3541704 96728 ?       Sl   Apr29  48:52 java -jar DummyTrkPartner.jar
[root@test_app_bm 2015_06_01_18_19_47_13098]# 
Kire Haglin
  • 6,569
  • 22
  • 27
Eugene To
  • 1,890
  • 2
  • 19
  • 30

1 Answers1

3

Sounds like a permissions issue. From your console excerpt, I see "jetty" running as a user, with you being logged in as root.

Run the command as the user "jetty" and you should be able to run jcmd.

avgvstvs
  • 6,196
  • 6
  • 43
  • 74
  • Any clues why `root` can't see all java processes? – Anders R. Bystrup Jun 02 '15 at 11:37
  • @AndersR.Bystrup , Depends, what linux distro are we talking about? Not all of them treat `root` the same way. – avgvstvs Jun 02 '15 at 12:01
  • 1
    This question explains some of what SELinux allows you to do to constrain the root account: http://security.stackexchange.com/questions/7801/keeping-secrets-from-root-on-linux Without having a lot more access to the system in question, its hard to tell what--if any--hardening procedures are in place. The key is that `root` isn't really all that special in *nix. – avgvstvs Jun 02 '15 at 12:02
  • I have a java process running under a specific user and i am running jcmd command as the same user as that of java process. Even then the jcmd command is not listing the java process. Please let me know your inputs on the same. – Eli Johnes Sep 29 '22 at 08:56
  • @EliJohnes this will have to be researched in the context of your own unique linux environment. There are too many variables to cover, the only thing you can do is learn what has been done to harden the environment. No easy answer. – avgvstvs Oct 04 '22 at 02:49