scala sbt和公司代理 - SunCertPathBuilderException [英] scala sbt and corporate proxy - SunCertPathBuilderException

查看:405
本文介绍了scala sbt和公司代理 - SunCertPathBuilderException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用SBT时,无法下载某些文件,并出现以下错误:

When I try to use SBT some files cannot be downloaded with the following error:

服务器访问错误:sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到所请求目标的有效证书路径url = https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.0.0-M4/sbt-1.0。 0-M4.jar

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=https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.0.0-M4/sbt-1.0.0-M4.jar

我已经遵循了stackoverflow的一些建议,并使用java keytool导入了公司代理SSL证书,如下所述:
Web服务代理中的SSL证书问题

I have followed some advices on stackoverflow and imported the corporate proxy SSL certificate with the java keytool as described in: SSL certificate problem in a web service proxy

它似乎不会影响SBT工具。它是否在不同的密钥库中查找?有什么想法吗?

It does not seems to affect the SBT tool. Does it look in a different keystore? Any ideas?

如果我将URL粘贴到浏览器上,文件会下载。

If i paste the URL on the browser the file downloads.

我收到此错误时只需运行我安装的SBT工具。当我尝试在IntelliJ Idea上创建一个SBT项目并对其进行更新时,它会给我带来不同URL的相同错误。尝试使用lightbend激活器时也是如此。

I get this error when simply running the SBT tool I have installed. When I try to create a SBT project on IntelliJ Idea and update it, it gives me the same error with different URLs. Same thing when trying to use the lightbend activator.

谢谢。

推荐答案

当你在代理后面并且我们需要将代理服务器证书添加到java信任库时会发生这种情况

So this happens when you are behind a proxy and we need the proxy server certificate to be added to the java truststore

cp $JAVA_HOME/jre/lib/security/cacerts <some accessible dir>/
# Get the certificate of the proxy server and store it in a file-proxy.pem
keytool -keystore caerts -import -file proxy.pem -alias my_proxy
# Now we can invoke sbt with following config
sbt  "-Djavax.net.ssl.trustStore=/path/to/included/proxycert/cacerts" compile

这篇关于scala sbt和公司代理 - SunCertPathBuilderException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆