I wanted to outline some misunderstanding and give some guidance on monitoring java web apps via remote JMX. The flavor of how you're hosting the java application, e.g. Tomcat, Websphere, etc, all follow the same foundation.
First, the java web application can be accessed via a web browser (typically on port 8080) but the detailed performance info is accessed on a different port called remote JMX. Java applications do not have this remote JMX port enabled by default. You have to manually enable it. The "how" part can vary based on tomcat or websphere and can even change based on the version you're running of each. This is where the initial confusion can begin. Since I can't outline every way to configure it, i'll outline the basic concept and let you use some google fu to fill in the blanks.
For Tomcat deployments
We need to find the JAVA_OPTS startup setting. It is normally defined in whatever startup script java uses.
For Linux, it's typically a file called setenv.sh and is located in the bin folder in the application's install directory.
For Windows it's typically a GUI app with a java tab and java options section.
Start > All Programs > Apache Tomcat > Tomcat Configuration
Or open the tomcat7w.exe or tomcat8w.exe (depending on your version of java) via command prompt or powershell.
For WebSphere, it's found in the admin web interface for that application.
When you find it, you need to add the following 4 options. For linux, they need to be all on the same line with a space separating them. For Windows, multi-line usually works.
For WebSphere/WebLogic deployments
First, we need to enable the remote JMX on a global level. In the WebSphere administration, there is a setting called "Platform MBean Server" that needs to be enabled. It's location and exact name varies based on your version of WebSphere but it is typically found in the Admin WebUI: Domain > Configuration > General > Advanced > Platform MBean Server Enabled Checkbox.
Once that is enabled then we need to add the following to each webspehere instance we want to monitor. Find the JAVA_OPTS area of startup and add these lines.
-Djava.rmi.server.hostname=<websphere server ip>
*The last setting, replace <websphere server ip> with the IP of your webspehere server.
Thejmxremote.port=can be any port you want that isn't already in use. The templates in SAM default to using port 8686.
*If you have multiple java apps running on the same server like I do, then come up with a standard port convention to make it easier.
*My java apps ran on ports 8040, 8050, 8060, 8070 and 8080. That means that I would have to add those JAVA_OPTS to EACH of those instances that I want to monitor. So each corresponding JMX port was 2040, 2050, 2060, 2070 and 2080.
The jmxremote.authenticate=false and jmxremote.ssl=false are set to false only in this example and for testing purposes. There are a lot more variables that could break and troubleshooting it is a pain. Setting those to true is recommended but involve a lot of extra config which would really fall outside of the scope of this article.
Once those settings above are in place it will require a service restart to take effect. If you have a dev server, great! If not, schedule a maintenance window.
First, we need to see if the operating system is using the port. Run the following commands via SSH or on Windows Command Prompt/PowerShell.
Linux:netstat -nlp | grep 8686
Windows:netstat -ano | findstr "8686"
If nothing returns then something isn't setup correctly with the java opts, this is where google will be your friend.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community.
More than 150,000 members are here to solve problems, share technology and best practices, and directly
contribute to our product development process.