How to Enable JMX in Tomcat to Monitoring | ubuntu 18.04 LTS - TechBeginner

Welcome to TechBeginner.in, Tech Beginner provides technical blog for Online Linux Tutorials, Ubuntu Tutorials, Redhat Tutorials and CentOS 7, Configuration of server like Web Server, Application server, Database server, Window server, networking, html, css, java script, php, wordpress, opencart, magento, joomla and etc.

How to Enable JMX in Tomcat to Monitoring | ubuntu 18.04 LTS

Share This

 

In this post, We will configure JMX with Apache Tomcat on ubuntu.

 

Java Management Extensions (JMX) is a Java innovation that provisions instruments for overseeing and observing applications, framework objects, gadgets, (for example, printers) and administration situated organizations. Those assets are spoken to by objects called MBeans (for Managed Bean).


I believe you have already installed Apache Tomcat on ubuntu machine if not so then use the given url to install Apache Tomcat on ubuntu.

 

https://www.techbeginer.in/2019/12/how-to-install-apache-tomcat8-on-ubuntu.html

 
Step 1: JMX Integration
 

You need to open the Apache Tomcat's config file called setenv.sh which is located in /opt/tomcat/bin/setenv.sh and based on your home directory of Apache tomcat and use the following command for the same.


sudo vim /opt/tomcat/bin/setenv.sh 

 

After that you need to add the following syntax.


export CATALINA_OPTS="-Dcom.sun.management.jmxremote
                      -Dcom.sun.management.jmxremote.port=9000
                      -Dcom.sun.management.jmxremote.rmi.port=9000
                      -Dcom.sun.management.jmxremote.local.only=false
                      -Djava.rmi.server.hostname=10.10.0.33
                      -Dcom.sun.management.jmxremote.authenticate=false
                      -Dcom.sun.management.jmxremote.ssl=false
                      -Djava.net.preferIPv4Stack=true"


Save and exit from the vim text editor.


Step 2: Restart the Tomcat Service
 

It is required to restart the service to get new changes for JMX integration we have configured with host IP address and port 9000, Use the following command for that.

sudo systemctl restart tomcat

Lets verify the Tomcat server status.

sudo systemctl status tomcat
 
Step 3: Verify the Port
 

Now you need to verify the port 9000 for JMX is running or not, Use the given command to get the port status.

netstate -plntu | grep 9000

If everything is correctly configured So then you will get port 9000 in your system.

 

Conclusion

We have successfully configured JMX in Apache Tomcat , Still you are facing same issue then leave a comment with your problem to get better support.

No comments:

Post a Comment