41

When I try to use JMX to monitor an application like this:

java -Dcom.sun.management.jmxremote.port=9999 \
     -Dcom.sun.management.jmxremote.authenticate=false \
     -Dcom.sun.management.jmxremote.ssl=false \
     JMX_tester

it tells me:

Error: Password file read access must be restricted:
       /usr/lib/jvm/java-7-oracle/jre/lib/management/jmxremote.password

Yet, when I use chmod to restrict the read access, it tells me:

Error: can't read password file

Am I going insane or something? How can I fix this?

This is Ubuntu btw, with the latest oracle jdk

chalimartines
  • 5,603
  • 2
  • 23
  • 33
Black Magic
  • 2,706
  • 5
  • 35
  • 58

2 Answers2

69

Make sure the user you are using to run the java process have access to the file (owner/read permissions).

Try:

chmod 600 jmxremote.password

Plus I suggest you'll make your own password file and run it with

-Dcom.sun.management.jmxremote.password.file=pwFilePath

All explained here.

charego
  • 137
  • 9
Elad Tabak
  • 2,317
  • 4
  • 23
  • 33
1

If you want to bypass authentication try to use below parameters.

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=port
-Dcom.sun.management.jmxremote.ssl=false
Jekin Kalariya
  • 3,475
  • 2
  • 20
  • 32