I am having client certificate in .pfx format that contains client certificate, root certificate and private key. I need to connect to service using SSL and I'm having no luck doing this.

what I have tried so far:

Java Code:
System.setProperty("javax.net.ssl.keyStore", "cert.pfx");
System.setProperty("javax.net.ssl.keyStorePassword", "pass");
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");

System.setProperty("javax.net.ssl.trustStore", "cert.pfx");
System.setProperty("javax.net.ssl.trustStorePassword", "pass");
System.setProperty("javax.net.ssl.trustStoreType", "PKCS12");
Then, I tried to create keystore programatically:

Java Code:
String alias = "";
try (FileInputStream stream = new FileInputStream("cert.pfx")) {
KeyStore store = KeyStore.getInstance(ip);
store.load(stream, "pass".toCharArray());

SSLContext context = SSLContext.getInstance("SSLv3");
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(store, "pass".toCharArray());

context.init(keyManagerFactory.getKeyManagers(), null, new SecureRandom());
SSLSocketFactory ssf = context.getSocketFactory();
SSLSocket sslsocket = (SSLSocket) ssf.createSocket(ip, port);
sslsocket.setEnabledProtocols(new String[]{"SSLv3"});
sslsocket.setUseClientMode(true);
sslsocket.startHandshake();
But no luck, I'm getting following error:

Java Code:
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
Is this the right way to connect to service using .pfx file?