You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/03/05 13:36:22 UTC

[Bug 56219] New: Failure to parse MergedWebXml in Jasper in 7.0.52 when in Strict Compliance mode for 2.5 and earlier web apps

https://issues.apache.org/bugzilla/show_bug.cgi?id=56219

            Bug ID: 56219
           Summary: Failure to parse MergedWebXml in Jasper in 7.0.52 when
                    in Strict Compliance mode for 2.5 and earlier web apps
           Product: Tomcat 7
           Version: 7.0.52
          Hardware: PC
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: knst.kolinko@gmail.com

(Filing an issue for an already fixed bug, to better document it)

This was observed for Web Applications that
1. use Servlet 2.5 or earlier schemas/dtds in their web.xml file.
2. and have a Filter configured.

Steps to reproduce:

1. Put Tomcat 7.0.52 into "scrict servlet compliance" mode by adding the
following line to conf/catalina.properties:

[[[
org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
]]]

2. Replace webapps/ROOT/WEB-INF/web.xml with the following text
(It is web.xml from Tomcat 6 ROOT app  plus a added a <filter>):

[[[
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<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_2_5.xsd"
   version="2.5">

  <display-name>Welcome to Tomcat</display-name>
  <description>
     Welcome to Tomcat
  </description>

    <filter>
        <filter-name>setCharacterEncodingFilter</filter-name>
       
<filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>setCharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>
]]]

3. Start Tomcat and access a JSP page:
http://localhost:8080/index.jsp

Expected: Tomcat Welcome page.
Actual: It fails with error 500 and
[[[
org.xml.sax.SAXParseException; systemId: file:///<CATALINA
HOME>/bin/org.apache.tomcat.util.scan.MergedWebXml; lineNumber: 13;
columnNumber: 22; cvc-complex-type.2.4.a: Invalid content was found starting
with element 'async-supported'. One of
'{"http://java.sun.com/xml/ns/javaee":init-param}' is expected.

com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
 (...)

com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
 org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:114)
 org.apache.jasper.compiler.JspConfig.processWebDotXml(JspConfig.java:95)
 org.apache.jasper.compiler.JspConfig.init(JspConfig.java:243)
 org.apache.jasper.compiler.JspConfig.findJspProperty(JspConfig.java:302)
 org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:114)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
]]]


The cause is that MergedWebXml that is used to pass configuration from Tomcat
(Catalina) to JSP Engine (Jasper) was generated incorrectly for the specified
version.

The XML text generated for a filter had 
<async-supported>false</async-supported>, but such option is available for
filters only starting with Servlet 3.0


Notes:
1. The generated XML can be logged with <Context logEffectiveWebXml="true" />
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

2. Tomcat 6 and 8 are not affected.
Tomcat 6 does not have web.xml merging, as support for web fragments is in
Servlet 3.0 and later.
Tomcat 8 uses different mechanism to pass configuration to Jasper.

Mail Threads:
http://marc.info/?t=139271851500004&r=1&w=2

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56219] Failure to parse MergedWebXml in Jasper in 7.0.52 when in Strict Compliance mode for 2.5 and earlier web apps

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56219

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
                 OS|                            |All

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
Fixed in 7.0 and will be in 7.0.53.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org