11

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.

amrk7
  • 1,194
  • 5
  • 13
  • 33

1 Answers1

8

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.

amrk7
  • 1,194
  • 5
  • 13
  • 33
  • Hi I am also getting same Exception.In which file I should configure in my tomcat. Thank you – Prabha Mar 19 '14 at 11:15
  • You will have to add these to catalina.sh – amrk7 Mar 20 '14 at 11:59
  • I had a successful connection on port 7091 but my webapp is running on port 8080. I am new to monitoring, do I still see the memory impact of my webapp to the server if I am monitoring on port 7091? – KasparTr Apr 28 '16 at 09:13
  • @KasparTr, yes you will, all events are relayed to the debug port. Thats how you are able to connect and monitor the app metrics. – amrk7 Aug 01 '16 at 02:59