title: Tomcat apps fail to deploy with STRICT_SERVLET_COMPLIANCE=true
body: <p>I am trying to deploy an application on Tomcat 8.0.39 with option STRICT_SERVLET_COMPLIANCE=true by updating apache-tomcat-8.0.39\conf\catalina.properties but as soon as I do that my application deployment fails.
  i.e. I start getting errors:
  SEVERE [localhost-startStop-1] org.apache.tomcat.util.digester.Digester.error Parse Error for all the tags in applications web.xml file.</p>
  
  <p>One of the stack trace is as follows:</p>
  
  <blockquote>
    <p>09-Feb-2017 15:06:32.189 SEVERE [localhost-startStop-1] org.apache.tomcat.util.digester.Digester.error Parse Error at line 5 column 66: Document root element "web-app", must match DOCTYPE root "xml".
     org.xml.sax.SAXParseException; systemId: file:/C:/Servers/Tomcat%208/apache-tomcat-8.0.39/webapps/file-service/WEB-INF/web.xml; lineNumber: 5; columnNumber: 66; Document root element "web-app", must match DOCTYPE root "xml".
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1448)
        at org.apache.tomcat.util.descriptor.web.WebXmlParser.parseWebXml(WebXmlParser.java:119)
        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1119)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:783)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5213)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)</p>
  </blockquote>
  
  <p>For resolving that issue, I tried following options:</p>
  
  <p>1) Added following in catalina.properties:</p>
  
  <pre><code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
  org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR=false
  </code></pre>
  
  <p>2) Updated agent WAR web.xml File
  Updated web-app_3_0.xsd with web-app_2_5.xsd
  Updated version="3.0" with version="2.5"</p>
  
  <p>I also tried copying "web-app" tag entry from apache-tomcat-8.0.39\conf\web.xml to my applications web.xml but of no use.</p>
  
  <p>3) Tried setting following values to their respective default values [as setting </p>
  
  <pre><code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true changes these defaults]
  org.apache.catalina.core.ApplicationContext.GET_RESOURCE_REQUIRE_SLASH
  org.apache.catalina.core.ApplicationDispatcher.WRAP_SAME_OBJECT
  org.apache.catalina.core.StandardHostValve.ACCESS_SESSION
  org.apache.catalina.session.StandardSession.ACTIVITY_CHECK
  org.apache.catalina.session.StandardSession.LAST_ACCESS_AT_START
  org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING
  
  The **URIEncoding** attribute of any HTTP connector or AJP connector element.
  The **resourceOnlyServlets** attribute of any Context element.
  The **tldValidation** attribute of any Context element.
  The **useRelativeRedirects** attribute of any Context element.
  The **xmlNamespaceAware** attribute of any Context element.
  The **xmlValidation** attribute of any Context element.
  </code></pre>
  
  <p>But nothing seems to be working fine. I am also not able to navigate to tomcat manager or any other application deployed.</p>
  
  <p>On the other hand every thing works fine when I write STRICT_SERVLET_COMPLIANCE=false in catalina.properties</p>
  
  <p>Is there something which I am missing here? Please help me in resolving this issue.</p>
  
  <p>Regards,
  Bhupesh</p>