3

So I installed ANT in my machine today and trying to play around with it. I'm trying to run my first command ant retrieveUnpackaged from the sample folder of salesforce and I'm getting the following error.

BUILD FAILED

Failed to login: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':html'.

so I used ant -verbose to dig deeper and it seems like my task definitions were not found. This was my main error in the command prompt.

Could not load definitions from resource

com/salesforce/antlib.xml

Would anyone throw some light on what that issue means and how to resolve it please?

  • 1
    I faced this error when i try to authenticate the callouts with username and password with invalid credentials. Please double check your credentials you use for connecting org. – Vigneshwaran G Sep 30 '15 at 1:10
  • Thanks. You're right. It was credentials problem. That issue derailed me totally. I don't know why it didn't say something like "In-valid username or password". Please answer and I'll mark it. – sam_s Sep 30 '15 at 2:09
  • Added an explanation for the inappropriate error message to my answer. Take a look. – Vigneshwaran G Sep 30 '15 at 4:12
  • I've seen the "Unexpected Element Parser was expecting element" issues when the ant/lib directory has conflicting jars. – Carl Weiss Sep 27 '17 at 15:22
2

I faced this error when i try to authenticate the callouts with username and password with invalid credentials. Please double check your credentials you use for connecting org.

Explanation for inappropriate error message:

When you try to login to any site, if your credentials are wrong it show you 'Invalid credentials'. But originally it returns a html document which have a text 'Invalid credentials' along with other html components.

The same happens via SOAP login as well. If successful login it returns SOAP messages. If unsuccessful login it returns the html document which having text like 'Invalid credentials'.

But our tool expects specific format but got html. So it throws

Unexpected element. Parser was expecting element http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':html'

Hope it helps you to understand better.

  • Check the sf.serverurl too. – Bryan Jul 5 '18 at 14:11

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.