Missing default AssertionConsumerService in SP metadata

Exception:

java.lang.IndexOutOfBoundsException  (at com.sun.identity.saml2.profile.SPSSOFederate.createAuthnRequest(SPSSOFederate.java:726))Exception: com.sun.identity.saml2.common.SAML2

Exception:

Could not find Single Sign-on Service URL.  (at  at com.sun.identity.saml2.profile.SPSSOFederate.initiateAuthnRequest(SPSSOFederate.java:264))

Reason:

Unsupported configuration in sp.xml concerning AssertionConsumerService.

Solution:

One of the <AssertionConsumerService> elements must have the isDefault="true" attribute and it must be the one with index="0".