Go to All Forums

Behind Proxy Java Code

Hi Team,

As I am behind proxy and I am trying to access REST API through java code.

Can anybody share the java code for setting proxy.

As I have already tried below code

// HTTPS

System.setProperty("https.proxyHost", "https://proxy.abc.com");

System.setProperty("https.proxyPort", "443");

 

But I am getting below error :

 

Exception in thread "main" 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 targetxception in thread "main" 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:1949) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)

 

Like (1) Reply
Replies (1)

This error can possibly occur, if the jvm version you are using does not recognize the Certificate Authority whom we use. Can you try using latest java version?

Like (0) Reply

Was this post helpful?