How to Enable JMX port in weblogic 10, 11g, 12c

Weblogic 12c application server is more similar to weblogic 11g in terms of configuring the JMX port. To Enable the JMX port and configuration in weblogic, we have to update the jmxremote flags into setDomainEnv.sh (or) setDomainEnv.cmd file

JMX monitoring is essential for better proactive monitoring and to perform diagnosis (or) troubleshooting in the weblogic infrastructure.

Tools like VisualVM, Jconsole, Java Mission Control uses JMX as their base technology (or) protocol. By having JMX enabled,  you could do highly efficient performance tuning and debugging tasks like Flight recording etc.

setDomainEnv.sh (or) setDomainEnv.cmd file can be found in the weblogic DOMAIN_HOME/bin directory.

Note* The following procedure can be used for all three subjected (weblogic 10, 11g, 12c) versions

How to Enable JMX in Weblogic  with NO Password ( InSecure)

Unix - setDomainEnv.sh

JAVA_OPTIONS="${JAVA_OPTIONS} 
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false"
export JAVA_OPTIONS

Windows - setDomainEnv.cmd

set JAVA_OPTIONS=%JAVA_OPTIONS% 
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false

 

How to Enable JMX in Weblogic with Password ( Secure)

Unix - setDomainEnv.sh

JAVA_OPTIONS="${JAVA_OPTIONS} 
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.access.file=jmxremote.access
-Dcom.sun.management.jmxremote.password.file=jmxremote.password"
export JAVA_OPTIONS

Windows - setDomainEnv.cmd

set JAVA_OPTIONS=%JAVA_OPTIONS% 
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.access.file=jmxremote.access
-Dcom.sun.management.jmxremote.password.file=jmxremote.password
-Dcom.sun.management.jmxremote.authenticate=true

Here we have used the access configuration files named jmxremote.access and jmxremote.password

jmxremote.access file is used to define the username and his privilage/role

jmxremote.password refers to the username already mentioned in jmxremote.access and mention its password as a clear text

To control the user privileges (or) roles like monitor and Administrator. It should be configured as read-only and read-write inside the jmxremote.access file

The user id who has read-write privileges considered as administrator

jmxremote.access file

# The "monitor" role has readonly access.
# The "admin" role has readwrite access.
monitor readonly
admin readwrite

jmxremote.password file

# specify actual password instead of the text password
monitor password
admin password

 

How to enable JMX and change the JMX port for Specific Instance

When you have multiple JVMs/instances running in the same box, you must specify a different JMX port for both of them. So you cannot add this flags at the global level as it will lead to port conflict.

If you do that, Early bird catches its worm; Only the JVM starts first gets the port the next one will fail with port conflict error.

To avoid this. You must isolate the JMX configuration of instances from each other.  But all the time, we get into this two big questions

"There's a lot of lines, Where to add these flags exactly ?"

"How to define configuration, specific to a single instance (or) JVM."

Here is the answer.

Find the last occurrence of the line "JAVA_OPTIONS="${JAVA_OPTIONS}" in the whole setDomainEnv.sh (or) setDomainEnv.cmd file and add these flags beneath. Along with the Conditional ServerName validation like shown in the following snapshot.

JAVA_OPTIONS="${JAVA_OPTIONS}"
export JAVA_OPTIONS

if [ "$SERVER_NAME" == "AdminServer" ]
then
        JAVA_OPTIONS="${JAVA_OPTIONS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.access.file=jmxremote.access -Dcom.sun.management.jmxremote.password.file=jmxremote.password"
        export JAVA_OPTIONS

elif [ "$SERVER_NAME" == "mwiserver1" ]
then
        JAVA_OPTIONS="${JAVA_OPTIONS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8889 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.access.file=jmxremote.access -Dcom.sun.management.jmxremote.password.file=jmxremote.password"
        export JAVA_OPTIONS     
fi

 

 

Cheers

Sarav AK

Follow me on Linkedin My Profile
Follow DevopsJunction onFacebook orTwitter
For more practical videos and tutorials. Subscribe to our channel

Buy Me a Coffee at ko-fi.com

Signup for Exclusive "Subscriber-only" Content

Loading