0

I've tomcat running with these options

-Dcom.sun.management.jmxremote=true 
-Dcom.sun.management.jmxremote.port=8686 
-Dcom.sun.management.jmxremote.authenticate=false

now I'm trying to connect to this server with this java code

JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8686/jmxrmi");
JMXConnector jmxc = JMXConnectorFactory.connect(url, null);

and getting this error

Exception in thread "main" java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: 
    javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:304)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:129)
    at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
    at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2392)
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:308)
    at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:268)
    at com.sandbox.TomcatWatcher.main(TomcatWatcher.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
    at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1959)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
    at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:702)
    at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    at java.io.DataOutputStream.flush(DataOutputStream.java:123)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:229)
    ... 12 more

I'm trying to connect to local tomcat instance with no credentials, could anybody explain where is my mistake here?

vach
  • 10,571
  • 12
  • 68
  • 106
  • 1
    Seems a certificate problem. What if you start Tomcat with `-Dcom.sun.management.jmxremote.ssl=false` ? – Raffaele Dec 20 '13 at 13:48
  • Problem is that even without any vm args starting tomcat it is publishing jmx server and jconsole easily detects it, but i dont know how to get it programatically. – vach Dec 22 '13 at 08:43
  • 1
    This answer works for me, http://stackoverflow.com/a/5555017/691626 – Dino Tw Jun 03 '15 at 19:56

0 Answers0