Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Connecting to Virgo's JMX(Unable to connect programmatically to Virgo's JMX using TCP port due to SunCertPathBuilderException)
Connecting to Virgo's JMX [message #857513] Thu, 26 April 2012 15:58 Go to next message
Daniel McGreal is currently offline Daniel McGreal
Messages: 27
Registered: April 2012
Junior Member
Hi,
I'm trying to connect to Virgo's JMX port using the standard options of 2.1.

I found a bug-report at youtrack.jetbrains.com/ issue/ IDEA-72569 (sorry, had to disguise the link) which seems to say that the default options for JMX need to be changed before they'll work, but I'm not sure if this is even relevant to my experience although the symptoms seem to match.

import java.util.HashMap;
import java.util.Map;
import java.io.IOException;

import javax.management.MBeanServerConnection;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

public class Test{
        private JMXConnector connector;
        private MBeanServerConnection connection;

        private void connect() throws IOException
        {
                JMXServiceURL jmxUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9875/jmxrmi");
                Map<String,Object> env = new HashMap<String,Object>();
                env.put("jmx.remote.credentials", new String[] {"admin", "springsource"});
                connector = JMXConnectorFactory.connect(jmxUrl, env);
                connection = connector.getMBeanServerConnection();
        }

        public static void main(String... args){
                try{ new Test().connect();
                }catch (Exception e){ e.printStackTrace(); }
        }
}


Quote:
java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
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:128)
at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2370)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:296)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:267)
at Test.connect(Test.java:19)
at Test.main(Test.java:24)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1868)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1337)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:154)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:998)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1294)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:685)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:111)
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)
... 8 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
at sun.security.validator.Validator.validate(Validator.java:260)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:326)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1319)
... 19 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
... 25 more


Have I done something wrong, or is there something I need to change to make this work?

Pre-thanks,
Dan.
Re: Connecting to Virgo's JMX [message #857568 is a reply to message #857513] Thu, 26 April 2012 17:04 Go to previous message
Violeta Georgieva is currently offline Violeta Georgieva
Messages: 238
Registered: October 2010
Senior Member
Hi

I found that one - https://blogs.oracle.com/gc/entry/unable_to_find_valid_certification may be helpful?

Regards
Violeta
Previous Topic:virgo ide installation failed
Next Topic:Equinox Registry and Adapter factory
Goto Forum:
  


Current Time: Thu Sep 18 19:55:10 GMT 2014

Powered by FUDForum. Page generated in 0.11266 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software