0
votes

When I try to start tomcat without an internet connection, an error is thrown when parsing the web.xml located in CATALINA_HOME/conf/web.xml. (CATALINA_HOME is/usr/share/tomcat8.5 in my environment)

org.apache.tomcat.util.digester.Digester.error Parse Error at line 20 column 193: Schema error: no attribute named "lang" was defined in schema : http://www.w3.org/XML/1998/namespace.
 org.xml.sax.SAXParseException; systemId: file:/usr/share/tomcat8.5/conf/web.xml; lineNumber: 20; columnNumber: 193; Schema error: no attribute named "lang" was defined in schema : http://www.w3.org/XML/1998/namespace.

I have determined the problem is it is trying to fetch an xsd file located at http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd but since it is offline it cannot and the web.xml namespace is incomplete.

I have tried downloading web-app_3_1.xsd and placing it in /usr/share/tomcat8.5/conf/web-app_3_1.xsd and then referencing it in the web.xml by changing the first few lines to

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee web-app_3_1.xsd" 
version="3.1">

but it still will throw the same error. I have also tried pointing to the file like file:///usr/share/tomcat8.5/conf/web-app_3_1.xsd but that also did not work as it threw a FileNotFoundException even though the file exists and belongs to the tomcat user.

Any help to fix the problem or workarounds to allow deployment when there is no internet connection is appreciated!

1

1 Answers

0
votes

We found a solution by changing STRICT_SERVLET_COMPLIANCE from true to false in tomcat/conf/catalina.properties. This stops it from checking the xml against its schema file and since it no longers tries to fetch the schema file, it allows it to work offline.