I am trying to monitor a remote process using jconsole and this was the command I used
jconsole -debug localhost:4080
And this is the stack trace that I get
java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.io.EOFException
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:286)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at sun.tools.jconsole.ProxyClient.checkSslConfig(ProxyClient.java:217)
at sun.tools.jconsole.ProxyClient.<init>(ProxyClient.java:110)
at sun.tools.jconsole.ProxyClient.getProxyClient(ProxyClient.java:463)
at sun.tools.jconsole.JConsole$3.run(JConsole.java:510)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:250)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:228)
It is able to attach successfully if I supply the pid of the process to jconsole.
We have to configure tomcat to allow a remote process to connect to it to monitor
Essentially added,
CATALINA_OPTS="-Djava.awt.headless=true -Xmx128M -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
This would tell tomcat that it would monitored from (say) jconsole through port 7091 remotely.
Then started jconsole with
jconsole localhost:7091
Now jconsole connects successfully.