Environment
Java 8
Retain for Windows
Retain for Linux
Situation
Resolution
The Java Monitoring & Management Console (JConsole) is a tool designed to see how much memory usage, CPU usage, threads and other monitoring tasks for JAVA applicatins, such as Retain Tomcat.
RETAIN FOR WINDOWS
You must configure the Retain Tomcat service in JAVA before being able to see the it within JConsole.
- Launch Configure Tomcat.
- Click on the Java tab.
- In the Java Options window, add these parameters:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
- Ok the changes and restart the Retain Tomcat service.
Tip: You can change the port from 9010 to anything you want by changing the the port parameter. If port 9010 is in use, you can change it to something different. Restart Retain Tomcat service after you have changed it, or you will not be able to connect.
If you want to see which ports are in use, or listening, go to a command prompt and type netstat -abno.
- Open a command window.
- Change to the Java JDK's bin directory: [drive]:\Program Files\Beginfinite\Retain\Java8\jdk1.[version]\lib
- Launch jconsole by typing jconsole.jar and presssing ENTER.
This will launch the Java Monitoring and Management Console (JConsole)
7.In the Remote Process: field type in localhost: (or ipaddress of server) and the port number specified in the paramters (9010). i.e. localhost:9010. Don't forget the colon after the localhost, and don't add any spaces in between them either.
Ignore the Username and Password and click connect. This will connect to the JConsole.
RETAIN FOR LINUX
The JConsole for Linux can only be run on using a GUI.
To setup JConsole with Linux follow these steps:
- Go to the /etc directory
- Edit profile (vi profile)
- Look for the section: make path more comfortable and go to the bottom where it reads: export PATH=
- Type: export PATH=$PATH:/opt/beginfinite/retain/java8/jdk1.8.0_60/bin/ Save the file.
This will make it so that you can run JAVA without having to go to the JAVA bin directory.
To setup to monitor JAVA and Tomcat:
- Navigate to /opt/beginfinite/retain/tomcat7/bin
- Edit the catalina.sh file
- Copy the following lines to the top of the file. Found that the easiest place was just after the comments section.
CATALINA_OPTS="-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"
9. Save the file.
10. Restart Tomcat
11. Go to /opt/beginfinite/java/java8/jdk1.8.0_60/lib
12.Type java –jar jconsole.jar
13.Enter in the field localhost (or ipaddress): 9010 i.e. localhost:9010