How to know the Port no where any process is running.

Hi all

I have jdk1.6 on my local machine and jdk 1.4 in my production environment. I want to use jconsole to be able to keep a watch on the java processes running in the production environment.

Can anybody tell me how should i proceed in using the jconsole so that i can monitor this remote server and know where and why the jvm is failing?

[360 byte] By [srinath944a] at [2007-10-3 3:50:38]
# 1

I think it will be tough to do this for 1.4. Starting with 1.5 you have many more tools that make it easier; see the manual page for jstatd for example.

One possibility would be to have a monitoring program that periodically runs a command to get the current list of processes ("ps" on Unix systems) and that creates a connector server that JConsole can connect to. Since you're on 1.4, you'll need to pick up an implementation of the JMX and JMX Remote APIs. The Reference Implementations of JSRs 3 and 160 would be a reasonable choice; see http://java.sun.com/products/JavaManagement/download.html

If you want to know why the JVMs are failing that looks like a much tougher task. One way would be to change the way you run your apps so that instead of calling the "java" command directly (/usr/bin/java or whatever), it runs a wrapper program or script that runs the original java program and detects a failure exit. It would put the details about the failure somewhere where the monitoring program can find them.

emcmanusa at 2007-7-14 21:48:07 > top of Java-index,Core,Monitoring & Management...
# 2
Well is it possible to monitor any processes running on the remote server to be monitored using the Jconsole. I tried doing that but i am unable to do so and always end getting one of the following errors: 1."non-JRMP server on the remote side" 2."connection refused"
srinath944a at 2007-7-14 21:48:07 > top of Java-index,Core,Monitoring & Management...
# 3

You cannot connect to a remote Java process with JConsole unless you have explicitly run the process in a way that allows it. With JDK 5.0, you can achieve that with system properties on the command line, such as -Dcom.sun.management.jmxremote.port. See http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html for details.

If you are running applications on JDK 1.4 and want to be able to connect remotely to them with JConsole, then you will need to add implementations of the JMX and JMX Remote APIs to your classpath, as I mentioned. Then you may find Luis-Miguel Alventosa's blog entry at <http://blogs.sun.com/lmalventosa/entry/mimicking_the_out_of_the> useful. I would suggest getting it to work with JDK 5.0 and the system properties, then following the instructions here to backport it to JDK 1.4. Alternatively you could investigate if your applications could be migrated to JDK 5.0.

emcmanusa at 2007-7-14 21:48:07 > top of Java-index,Core,Monitoring & Management...