$ cd $JAVA_HOME/jre/lib/management
$ cp jmxremote.password.template jmxremote.password
$ chmod u=rw jmxremote.password
$ vi jmxremote.password
Set a password for "monitorRole" and "controlRole":
monitorRole 12monitor
controlRole 55control
After then when I run JMX server on my machine I got following error.
# java -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.m
agement.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.ssl=false -D
java.rmi.server.host=47.168.96.31 com.example.Main
Error: Password file read access must be restricted: /root/Downloads/jdk1.6.0_29
/jre/lib/management/jmxremote.password
When I change the file permission with the oen of the following commands jmx server works.
# chmod 400 jmxremote.password
or
# chmod 600 jmxremote.password
But I could not connect it through username/password defined in jmxremote.password file
JMX (Java Management Extensions) technology provides a simple and standard way of managing and monitoring resources related to an instance of a Java Virtual Machine (JVM). This is achieved by instrumenting resources with Java objects known as Managed Beans (MBeans) that are registered with an MBean server.
JMX technology provides a component-based architecture for developing solutions to monitor and manage your applications, services, and resources. JMX technology is the way to instrument any application or service that was built using Java technology.
Java Management Extensions (JMX) is a Java technology that supplies tools for managing and monitoring applications, system objects, devices (such as printers) and service-oriented networks. Those resources are represented by objects called MBeans (for Managed Bean).
To add new username/password for JMX authorization, authentication has to be defined by adding the username in to jmxremote.access file. it should be like when adding username "admin"
>monitorRole readonly
>admin readonly
>controlRole readwrite \
create javax.management.monitor.*,javax.management.timer.* \
unregister
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With