0

I'm trying to run Ant Migration Tool Target using Jenkins CI from my server and getting next error:

BUILD FAILED
/var/lib/jenkins/workspace/<Jenkins Build Job Name>/build.xml:41: Failed to login: Failed to parse detail:  START_TAG seen ...</sf:exceptionMessage><sf:upgradeURL>... @1:752 due to: com.sforce.ws.ConnectionException: unable to find end tag at:  START_TAG seen ...</sf:exceptionMessage><sf:upgradeURL>... @1:752
    at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:227)
    at com.salesforce.ant.SFDCAntTask.getMetadataConnection(SFDCAntTask.java:257)
    at com.salesforce.ant.SFDCMDAPIAntTaskRunner.runTask(SFDCMDAPIAntTaskRunner.java:20)
    at com.salesforce.ant.DeployTask.execute(DeployTask.java:76)
    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 parse detail:  START_TAG seen ...</sf:exceptionMessage><sf:upgradeURL>... @1:752 due to: com.sforce.ws.ConnectionException: unable to find end tag at:  START_TAG seen ...</sf:exceptionMessage><sf:upgradeURL>... @1:752
    at com.sforce.ws.transport.SoapConnection.parseDetail(SoapConnection.java:238)
    at com.sforce.ws.transport.SoapConnection.createException(SoapConnection.java:204)
    at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:150)
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:99)
    at com.sforce.soap.partner.PartnerConnection.login(PartnerConnection.java:1433)
    at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:221)
    ... 20 more

Total time: 5 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

An important thing that I need to mention here is that I'm trying to run Ant on the Sandbox org, but when I try to run the same Target to the some another Dev org it's work fine.

This is a really strange error. Hope anybody can help me with that. Thanks in advance.

0

Just to enumerate the things to double-check when this problem arise:

  • Username
  • Password. Is it right? Is it expired?
  • Token
  • Connecting to Sandbox or Production? Check the URL.
  • TLS version (+1.1).
  • As I mentioned above, the token in our org. isn't required. The URL to the server is right too. Also I use "-Dhttps.protocols=TLSv1.1,TLSv1.2" ant argument to ensure the Java use TLS 1.1 – Ruslan Kurchenko Nov 9 '16 at 11:30
  • The API version in use? – Omar Villasmil Nov 11 '16 at 14:44
  • Other thing to check: the profile of the user in the Sandbox org is checked for "API Enabled" – Omar Villasmil Nov 11 '16 at 21:53
0

If it works on a DE org but doesn't work on a Sandbox and you're sure the Sandbox credentials are correct, I'm gonna toss out the educated guess that the problem is that you're not setting the serverurl argument on your sf:deploy call in your ant scripts. If connecting to a sandbox, ${sf.serverurl} in the example below should be https://test.salesforce.com

<sf:deploy
    username="${sf.username}"
    password="${sf.password}"
    serverurl="${sf.serverurl}"
    ...
    />
  • Hi. The target declaration is the same as you mentioned but I pass server URL as an argument when I run the job. ant deployCodeCheckOnly "-Dsf.username=<my.user.name>" "-Dsf.password=<my.password>" "-Dsf.serverurl=https://test.salesforce.com" "-Dhttps.protocols=TLSv1.1,TLSv1.2" – Ruslan Kurchenko Nov 9 '16 at 11:27
0
  1. Make sure you use the latest Ant Salesforce jar so that it uses the latest SOAP WSDL version. Also check with previous versions of Ant Salesforce jar. The problem seems the version you are using makes the connection using TLS v1.0 that is rejected by Salesforce. Upgrading the salesforce jar for Ant should do the trick.
  2. If you are using Java version of Java 7 or lower , use the following as params -Dhttps.protocols=TLSv1.1,TLSv1.2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.