昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期日, 四月 07, 2019

SBT dependency download problem

When run SBT, none of the dependencies can be downloaded.

I got this error:

Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=  




The reason is that the HTTP client used by JAVA doesn't trust any HTTPS certificate. You have to add all the certificates to the trustStore. 

Solution:

Instead of adding many certificates. I only added fiddler's certificate. This is a easier way to do it. I enable SSL decryption on my Fiddler (windows). This will make fiddler to resign all the packets. Then I export fiddler's root certificate to the desktop.

Use the following command to generate a keystore file.

keytool -import -file %userprofile%\Desktop\FiddlerRoot.cer -keystore FiddlerKeystore -alias Fiddler

I then copy this keystore file to the project folder.

Set the SBT_OPTS environment as below.

export SBT_OPTS="$SBT_OPTS -Dhttps.proxyHost=192.168.1.69 -Dhttps.proxyPort=8888 -Djavax.net.ssl.trustStore=/Users/fengnz/FiddlerKeystore -Djavax.net.ssl.trustStorePassword=Youpassword"  

Then run sbt command again, the problem resolved. 

And I can see all the downloading from Fiddler too.








没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.