function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sudip SahaSudip Saha 

Ant migration tool - Failed to login: Failed to send request

While trying to coonect to my sandbox org using Ant Migration Tool I am receiving below error. The same build.xml and build.properties file with the same version of java and ant run fine on a different machine. There are no certificates installed on the org. Any thoughts?

D:\ABCD>ant retrieveUnpackaged -verbose
Apache Ant(TM) version 1.10.1 compiled on February 2 2017
Trying the default build file: build.xml
Buildfile: D:\ABCD\build.xml
Detected Java version: 1.8 in: C:\Program Files (x86)\Java\jdk1.8.0_144\jre
Detected OS: Windows 7
parsing buildfile D:\ABCD\build.xml with URI = file:/D:/ABCD/build.xml
Project base dir set to: D:\ABCD
parsing buildfile jar:file:/D:/SOFTWARE/apache-ant-1.10.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/D:/SOFTWARE/apache-ant-1.10.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [property] Loading D:\ABCD\build.properties
 [property] Loading Environment env.
dropping D:\ant-salesforce.jar from path as it doesn't exist
parsing buildfile jar:file:/D:/SOFTWARE/apache-ant-1.10.1/lib/ant-salesforce.jar!/com/salesforce/antlib.xml with URI = jar:file:/D:/SOFTWARE/apache-ant-1.10.1/lib/ant-salesforce.jar!/com/salesforce/antlib.xml from a zip file
Build sequence for target(s) `retrieveUnpackaged' is [retrieveUnpackaged]
Complete build sequence is [retrieveUnpackaged, deployCode, deployCodeNoTestLevelSpecified, deployUnpackaged, describeMetadata, undeployCode, quickDeploy, deployCodeFailingTest, retrieveCode, deployCodeCheckOnly, cancelDeploy, listMetadata, deployZip, retrievePkg, test, bulkRetrieve, , deployCodeRunLocalTests]

retrieveUnpackaged:
    [mkdir] Skipping D:\ABCD\retrieveUnpackaged because it already exists.
parsing buildfile jar:file:/D:/SOFTWARE/apache-ant-1.10.1/lib/ant-salesforce.jar!/com/salesforce/antlib.xml with URI = jar:file:/D:/SOFTWARE/apache-ant-1.10.1/lib/ant-salesforce.jar!/com/salesforce/antlib.xml from a zip file
[sf:retrieve] Note: use ant -verbose to get more information on the failure

BUILD FAILED
D:\ABCD\build.xml:34: Failed to login: Failed to send request to https://test.salesforce.com/services/Soap/u/39.0
        at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:237)
        at com.salesforce.ant.SFDCAntTask.getMetadataConnection(SFDCAntTask.java:266)
        at com.salesforce.ant.SFDCMDAPIAntTaskRunner.runTask(SFDCMDAPIAntTaskRunner.java:20)
        at com.salesforce.ant.RetrieveTask.execute(RetrieveTask.java:110)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.Main.runBuild(Main.java:857)
        at org.apache.tools.ant.Main.startAnt(Main.java:236)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
Caused by: com.sforce.ws.ConnectionException: Failed to send request to https://test.salesforce.com/services/Soap/u/39.0
        at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:121)
        at com.sforce.soap.partner.PartnerConnection.login(PartnerConnection.java:813)
        at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:230)
        ... 20 more
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.Validator
Exception: PKIX path building failed: sun.security.provider.certpath.SunCertPath
BuilderException: 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:1959)
        at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
        at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
        at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1514)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:961)
        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.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
        at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:136)
        at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:100)
        at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:95)
        at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:91)
        at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:95)
        ... 22 more
Caused by: 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.validator.PKIXValidator.doBuild(PKIXValidator.java:397)
        at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
        at sun.security.validator.Validator.validate(Validator.java:260)
        at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
        at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
        at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
        at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1496)
        ... 39 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
        at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
        at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)
        ... 45 more

Total time: 3 seconds

D:\ABCD>
Alain CabonAlain Cabon
Hi,

Have you heard of TLS 1.0?

https://help.salesforce.com/articleView?id=000221207&type=1

Prerequisites for Using the Force.com Migration Tool​: Java version 1.7.x or later is recommended for better security and for the latest TLS security protocols.​
https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/forcemigrationtool_prereq.htm​

Old news now: TLS 1.0 has been disabled For Sandbox - Salesforce: The most common complains that I have received and encountered myself has been our IDE no more able to authenticate or our eclipse no more working ,or our migration tools are affected .

http://cloudyworlds.blogspot.fr/2016/06/tls-10-has-been-disabled-for-sandbox.html

User-added image


Regards
Sudip SahaSudip Saha
Alain,
If you would notice I amalready using JAVA 1.8 where TLS 1.0 is automatically disabled. Also i mentioned that this exact configuration works fine on a different machine. Is there anything that  i am missing?
Alain CabonAlain Cabon
Correct. JDK 8 so you are safe.

Note: use ant -verbose to get more information on the failure

That is only option for debugging more. You need a detailed log.

Regards