Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-11240

parsing web.xml via WebAppUtil is reporting error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • None

    Description

      when parsing `web.xml` with WebAppUtil to get webSiteId or control servlet path we can see the following trace in log:

       

      org.xml.sax.SAXParseException; lineNumber: 22; columnNumber: 24; cvc-elt.1: Cannot find the declaration of element 'web-app'.
      at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
      at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
      at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElementAfterName(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1431)
      at org.apache.ofbiz.webapp.WebAppUtil.parseWebXmlFile(WebAppUtil.java:260)
      at org.apache.ofbiz.webapp.WebAppUtil.getWebXml(WebAppUtil.java:232)
      at org.apache.ofbiz.webapp.WebAppUtil.getControlServletPath(WebAppUtil.java:82)
      at org.apache.ofbiz.webapp.WebAppUtil$getControlServletPath.call(Unknown Source)

       

      This not "really"  a problem since it is not an error but just a report, but it pollutes log a lot when you are trying to setBaseUrl in an email and code is scanning all webapp.

      I'm attaching a groovy script which produces the above report error (the report error is not really easy to produce in real ofbiz application)

       

      To fix it we should replace `web-app` xml tag declaration:

      replace
       
      <web-app version="3.0">

       with
       
      <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

      Attachments

        1. debug-webapp.groovy
          0.7 kB
          Samuel Trégouët

        Issue Links

          Activity

            People

              Unassigned Unassigned
              stregouet Samuel Trégouët
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: