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
John ClevelandJohn Cleveland 

Force.com Migration Tool Issues

I'm trying to test the connection with the Force.com Migration Tool and ANT to our salesforce org and while on the company network, I'm getting the below errors.  If I'm off of the company network, it will work, so it has to be the proxy.  I can't figure out how to get the proxy settings to work.  I've entered them in every place I've found mentioned out on the internet but nothing is working.  Anyone have any ideas?

Failed to login: Failed to send request to https://test.salesforce.com/services/Soap/u/31.0
at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:218)
at com.salesforce.ant.SFDCAntTask.getMetadataConnection(SFDCAntTask.java:248)
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:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
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://test.salesforce.com/services/Soap/u/31.0
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:120)
at com.sforce.soap.partner.PartnerConnection.login(PartnerConnection.java:1652)
at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:212)
... 20 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:275)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:371)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:975)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1091)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:133)
at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:97)
at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:92)
at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:88)
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:94)
... 22 more

Total time: 3 seconds
# On branch master
nothing to commit (working directory clean)
Everything up-to-date
Branch master set up to track remote branch master from origin.
Finished: SUCCESS
Best Answer chosen by John Cleveland
John ClevelandJohn Cleveland
Finally figured this out with the below.

<target name="probe-proxy">
    <property name="proxy.host" value="proxy.host.com"/>  
  
    <condition property="proxy.enabled">
      <and>
        <isset property="proxy.host"/>
        <isreachable host="${proxy.host}"/>
      </and>
    </condition>
  </target>

  <target name="proxy" depends="probe-proxy" if="proxy.enabled">
    <property name="proxy.host" value="proxy.host.com"/>  
    <property name="proxy.port" value="8080"/>
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"
      proxyuser="${proxy.user}" proxypassword="${proxy.pass}"/>
  </target>


All Answers

Michael VerhovskiMichael Verhovski
Did you have a chance to go over Ant Proxy Configuration (http://ant.apache.org/manual/proxy.html) instructions? How did you configured the proxy settings in your ANT?
John ClevelandJohn Cleveland
I added an environment variable of the below.

ANT_OPTS = -Dhttp.proxyHost=proxy.xxxxx.com -Dhttps.proxyPort=8080
John ClevelandJohn Cleveland
Finally figured this out with the below.

<target name="probe-proxy">
    <property name="proxy.host" value="proxy.host.com"/>  
  
    <condition property="proxy.enabled">
      <and>
        <isset property="proxy.host"/>
        <isreachable host="${proxy.host}"/>
      </and>
    </condition>
  </target>

  <target name="proxy" depends="probe-proxy" if="proxy.enabled">
    <property name="proxy.host" value="proxy.host.com"/>  
    <property name="proxy.port" value="8080"/>
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"
      proxyuser="${proxy.user}" proxypassword="${proxy.pass}"/>
  </target>


This was selected as the best answer
Jason DavisJason Davis
I had the same issue - user name correct, password correct (I don't have a proxy), the salesforce login logs showed that my user was logging in, but I still got:

Failed to login: unable to find end tag at: START_TAG seen ...... @1:952
.
.
.

However, I had a CLASSPATH environment variable set and after clearing it, everything worked.