ARTIFACTORY: How to resolve the error "Invalid content was found starting with element"
This error “Invalid content was found starting with element” during the Artifactory startup usually means there is a mandatory parameter that is missing or there is an invalid parameter in artifactory.config.latest.xml file.
For example, the below error denotes cronExp parameter is missing in artifactory.config.latest.xml
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://artifactory.jfrog.org/xsd/3.1.2":retentionPeriodHours} '. One of '{"http://artifactory.jfrog.org/xsd/3.1.2":dir , "http://artifactory.jfrog.org/xsd/3.1.2":cronExp} ' is expected.
Looking at artifactory.config.latest.xml file we can observe the cronExp tag is missing for one of the configuration fields. In the below case cronExp missing on the backup config:
Before the change:<backup> <key>backup-weekly</key> <enabled>false</enabled> <retentionPeriodHours>168</retentionPeriodHours> <createArchive>false</createArchive> <excludedRepositories/> <sendMailOnError>true</sendMailOnError> <excludeNewRepositories>false</excludeNewRepositories> <precalculate>false</precalculate> </backup>
Further, adding the parameter as shown below, renaming the
artifactory.config.latest.xml
to
artifactory.config.import.xml
and restarted Artifactory application to reflect the changes.
After the change:<backup> <key>backup-weekly</key> <enabled>false</enabled> <cronExp>0 0 2 ? * SAT</cronExp> <retentionPeriodHours>168</retentionPeriodHours> <createArchive>false</createArchive> <excludedRepositories/> <sendMailOnError>true</sendMailOnError> <excludeNewRepositories>false</excludeNewRepositories> <precalculate>false</precalculate> </backup>