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
ravisistlaravisistla 

Deployment issue with ANT - Failed to send request error

I am trying the sample deployment  from Force.com Migration Tool and getting an error. Below is the verbose copy of the error. I have verified that my login and password in the properties file are correct. Please advise what could be missing.

 

-----------------------------------------------------------------------------------------------------------------------
Complete build sequence is [test, listMetadata, deployCode, deployCodeFailingTes
t, retrieveCode, deployCodeCheckOnly, retrieveUnpackaged, retrievePkg, bulkRetri
eve, describeMetadata, deployUnpackaged, undeployCode, deployZip, ]

test:
parsing buildfile jar:file:/C:/Program%20Files/ANT/apache-ant-1.8.2/lib/ant-sale
sforce.jar!/com/salesforce/antlib.xml with URI = jar:file:/C:/Program%20Files/AN
T/apache-ant-1.8.2/lib/ant-salesforce.jar!/com/salesforce/antlib.xml from a zip
file
[sf:deploy] Note: use ant -verbose to get more information on the failure

BUILD FAILED
C:\Documents and Settings\HB39422\Desktop\SFDC-ANT\sample\build.xml:9: Failed to
 login: Failed to send request to https://login.salesforce.com/services/Soap/u/2
0.0
        at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:183)
        at com.salesforce.ant.SFDCAntTask.getMetadataConnection(SFDCAntTask.java
:212)
        at com.salesforce.ant.SFDCMDAPIAntTaskRunner.runTask(SFDCMDAPIAntTaskRun
ner.java:16)
        at com.salesforce.ant.DeployTask.execute(DeployTask.java:59)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:809)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: com.sforce.ws.ConnectionException: Failed to send request to https://
login.salesforce.com/services/Soap/u/20.0
        at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:117)
        at com.sforce.soap.partner.PartnerConnection.login(PartnerConnection.jav
a:872)
        at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:178)
        ... 20 more
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:529)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java
:559)
        at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketI
mpl.java:141)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:272)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewH
ttpClient(AbstractDelegateHttpsURLConnection.java:172)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:954)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:158)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLCo
nnection.java:1019)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Htt
psURLConnectionImpl.java:230)
        at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.
java:133)
        at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTranspor
t.java:97)
        at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTranspor
t.java:92)
        at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.jav
a:88)
        at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:94)
        ... 22 more

 

Sandysf1Sandysf1

Hi

Check that sf.serverurl = https://test.salesforce.com for sandbox and for production environment sf.serverurl= https://www.salesforce.com in build.properties file .Also check that sf.password should be password+security key.

ravisistlaravisistla

Thanks for the reply . In addition to password+key, I had to set the proxy as well since we are using it. That resolved the issue.

gammaygammay

Just for more clarity, if there is a proxy servver, the proxy has to be set  for ConnectorConfig.

 

 

		ConnectorConfig config = new ConnectorConfig();
		config.setUsername(USERNAME);
		config.setPassword(PASSWORD);
		config.setProxy("host", port;

 

Setting the proxy for the VM or environment variables won't work.

 

Took a while to figure it out!

 

 

badubsp1badubsp1

could you please reply how to set proxy

rksistlarksistla

You can the following line to your build XML doc right after the build properties doc.

 

 <setproxy proxyhost="prxoy server URL" proxyport="port num"/>


Himanshu Rana 7Himanshu Rana 7
follow the below  link to know how to deploy using ant
http://himanshurana.in/deploying-salesforce-data-using-ant/