Issue
I have a Spring web application built by maven that runs in an eclipse environment, but I am trying to deploy it to tomcat running on an Ubuntu server.
When I try to deploy it to the server it throws:
org.xml.sax.SAXParseException; systemId:
jar:file:/usr/share/tomcat8.5/webapplications/OpenElis2/WEB-INF/lib/spring-web-5.1.7.RELEASE.jar!/META-INF/web-fragment.xml;
lineNumber: 8; columnNumber: 18; schema_reference.4:
Failed to read schema document
'https://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd',
because
1) could not find the document;
2) the document could not be read;
3) the root element of the document is not <xsd:schema>.
I have confirmed that I can download a proper xsd file from this url from the server, but the error persists. I know that many of the spring xsd files are located in their jars, but I cannot locate this one anywhere in the generated war or spring jar.
Relevant software versions:
- Tomcat 8.5
- Java 8
- Spring 5.1.7
Any suggestions?
EDIT**
Failure appears to happen when xsd file url is https but not when regular http
Solution
We ran into the same problem.
This was actually not a ssl issue (there were no ssl logs at all), but rather seemed an incoherence between the namespace in http and the schema location in https.
One possible solution is to disable this validation if it is not required. Add the following parameter to your jvm.properties :
-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false
Chances are that this property is already defined with a true
value, which causes the validation.
If you want to know exactly what the property does, you can review at the official Tomcat 8 configuration manual
Hope it solves your problem.
Answered By - TheCopycat
Answer Checked By - Candace Johnson (JavaFixing Volunteer)