xml-maven-plugin icon indicating copy to clipboard operation
xml-maven-plugin copied to clipboard

Does not follow redirects when resolving schema for catalog.xml

Open runeflobakk opened this issue 3 years ago • 4 comments

I suddenly got the following error when executing validate in build which has previously worked for many years:

[ERROR] Failed to execute goal org.codehaus.mojo:xml-maven-plugin:1.0.2:validate (default) on project X: While parsing projectroot/catalog.xml, at http://www.oasis-open.org/committees/entity/release/1.1/catalog.xsd, line 2,  column 35: error: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '301 Moved Permanently'.
[ERROR] While parsing projectroot/catalog.xml, at http://www.oasis-open.org/committees/entity/release/1.1/catalog.xsd, line 4,  column 36: error: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '301 Moved Permanently'.
[ERROR] While parsing projectroot/catalog.xml, at http://www.oasis-open.org/committees/entity/release/1.1/catalog.xsd, line 5,  column 20: error: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'nginx'.
[ERROR] While parsing projectroot/catalog.xml, at http://www.oasis-open.org/committees/entity/release/1.1/catalog.xsd, line 6,  column 3: fatal error: The element type "hr" must be terminated by the matching end-tag "</hr>".
[ERROR] While parsing projectroot/catalog.xml, at http://www.oasis-open.org/committees/entity/release/1.1/catalog.xsd, line 6,  column 3: fatal error: The element type "hr" must be terminated by the matching end-tag "</hr>".

This hints about some error related to redirecting: "Saw '301 Moved Permanently'". Executing curl -sLD - http://www.oasis-open.org/committees/entity/release/1.1/catalog.xsd confirms the schema-URL has indeed been moved:

$ curl -sLD - http://www.oasis-open.org/committees/entity/release/1.1/catalog.xsd
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 11 Nov 2020 18:31:18 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://www.oasis-open.org/committees/entity/release/1.1/catalog.xsd

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 11 Nov 2020 18:31:19 GMT
Content-Type: application/xml
Content-Length: 8744
Connection: keep-alive
Last-Modified: Wed, 11 Nov 2020 03:21:33 GMT
ETag: "17c9e0-2228-5b3cc4ac9e940"
Accept-Ranges: bytes
Strict-Transport-Security: "max-age=31536000; includeSubDomains" always
...

I have changed the URL in my catalog.xml to https, and this solves the problem, but the http-client used internally by xml-maven-plugin should maybe be set up to follow redirects?

runeflobakk avatar Nov 11 '20 18:11 runeflobakk