ant编译tomcat7源码ant报javax.net.ssl.SSLHandshakeException错误

tomcat7源码下载下来后报

F:\codestudy\apache-tomcat-7.0.99-src>ant
Buildfile: F:\codestudy\apache-tomcat-7.0.99-src\build.xml

build-prepare:
   [delete] Deleting directory F:\codestudy\apache-tomcat-7.0.99-src\output\buil
d\temp
    [mkdir] Created dir: F:\codestudy\apache-tomcat-7.0.99-src\output\build\temp


download-compile:

testexist:
     [echo] Testing  for C:\Users\tomcat-build-libs/commons-daemon-1.
2.2/commons-daemon-1.2.2.jar

downloadgz-2:

testexist:
     [echo] Testing  for C:\Users\tomcat-build-libs/ecj-4.4.2/ecj-4.4
.2.jar

downloadfile-2:

testexist:
     [echo] Testing  for C:\Users\tomcat-build-libs/saaj-api-1.3.5/sa
aj-api-1.3.5.jar

setproxy:

downloadfile:
      [get] Getting: https://repo.maven.apache.org/maven2/javax/xml/soap/saaj-ap
i/1.3.5/saaj-api-1.3.5.jar
      [get] To: C:\Users\tomcat-build-libs\download-1935459700.tmp
      [get] Error getting https://repo.maven.apache.org/maven2/javax/xml/soap/sa
aj-api/1.3.5/saaj-api-1.3.5.jar to C:\Users\tomcat-build-libs\downloa
d-1935459700.tmp

BUILD FAILED
F:\codestudy\apache-tomcat-7.0.99-src\build.xml:2916: The following error occurr
ed while executing this line:
F:\codestudy\apache-tomcat-7.0.99-src\build.xml:3236: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find vali
d certification path to requested target

        at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
        at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959)
        at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:328)
        at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:322)
        at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.
java:1614)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.jav
a:216)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:987)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.
java:1385)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413
)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397
)
        at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:
559)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:185)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLCon
nectionImpl.java:162)
        at org.apache.tools.ant.taskdefs.Get$GetThread.openConnection(Get.java:7
66)
        at org.apache.tools.ant.taskdefs.Get$GetThread.get(Get.java:676)
        at org.apache.tools.ant.taskdefs.Get$GetThread.run(Get.java:666)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed:
 sun.security.provider.certpath.SunCertPathBuilderException: unable to find vali
d certification path to requested target
        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397)
        at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.jav
a:302)
        at sun.security.validator.Validator.validate(Validator.java:260)
        at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.j
ava:324)
        at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerIm
pl.java:229)
        at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustMan
agerImpl.java:124)
        at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.
java:1596)
        ... 13 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to
 find valid certification path to requested target
        at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBu
ilder.java:141)
        at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCert
PathBuilder.java:126)
        at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)
        ... 19 more

Total time: 3 seconds
 

这时候关注点不要紧盯着 javax.net.ssl.SSLHandshakeException,要正面解决这个问题应该挺费工夫,从错误往上看发现是获取这个包报错https://repo.maven.apache.org/maven2/javax/xml/soap/saaj-api/1.3.5/saaj-api-1.3.5.jar,直接将链接输入在浏览器上把这个包下载下来,然后放到日志打的标红目录下,

downloadfile:
      [get] Getting: https://repo.maven.apache.org/maven2/javax/xml/soap/saaj-ap
i/1.3.5/saaj-api-1.3.5.jar
      [get] To: C:\Users\tomcat-build-libs\download-1935459700.tmp
      [get] Error getting https://repo.maven.apache.org/maven2/javax/xml/soap/sa
aj-api/1.3.5/saaj-api-1.3.5.jar to C:\Users\tomcat-build-libs\downloa
d-1935459700.tmp

仿照其他jar包给包的文件夹取个文件名(jar包名叫saaj-api-1.3.5.jar,去掉.jar就是文件夹名)

然后再ant就成功了。

网上找了一圈都是下什么证书的,后来才发现上面有其他报错,记录一下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值