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 2022/09/29 07:52:51 UTC

[Bug 66285] New: <%@include directive fails to include files in subdirectories underneath WEB-INF since 9.0.67

https://bz.apache.org/bugzilla/show_bug.cgi?id=66285

            Bug ID: 66285
           Summary: <%@include directive fails to include files in
                    subdirectories underneath WEB-INF since 9.0.67
           Product: Tomcat 9
           Version: 9.0.67
          Hardware: PC
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: c.bollmeyer@lecare.com
  Target Milestone: -----

Hello,

we stumbled over a nasty regression when trying to upgrade some of our apps to
the latest version of Tomcat 9 in connection with the @include directive. The
issue seems to be only related to JSP files put underneath WEB-INF (for
security reasons) and appeared first in 9.0.67. Or apps work perfectly in
previous versions of Tomcat, some for 15 years, and up to Tomcat 9.0.65.

To provide some background, we use Tiles and Spring MVC or Struts to serve JSP
content from underneath /WEB-INF. The basic structure is like this

WEB-INF
  |--tiles
     |--layout
        | mainTemplate.jsp
        | errorTemplate
        | (...)
        |--config
          configuration.jspf

In the template JSP file, the configuration.jspf file gets included statically
into the templates via @import like this:

<%@include file="config/configuration.jspf" %>

Since 9.0.67, this does not work anymore, but ends up in a JasperException
claiming the included file could not be found:

28-Sep-2022 16:42:39.237 SEVERE [http-nio-9000-exec-4]
org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for
servlet [jsp] threw exception
        org.apache.jasper.JasperException:
/WEB-INF/tiles/layout/errorTemplate.jsp (Zeile: [14], Spalte: [1]) Datei
[config/configuration.jspf] nicht gefunden
                at
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
                at
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:292)
                at
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:98)
                at
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:349)
                at
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:384)
                at
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:485)
                at
org.apache.jasper.compiler.Parser.parseFileDirectives(Parser.java:1802)
                at org.apache.jasper.compiler.Parser.parse(Parser.java:141)
                at
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:245)
                at
org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:128)
                at
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:202)
                at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:391)
                at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:367)
                at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:351)
                at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:605)
                at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
                at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
                at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)


The included file is there, though. If we move the file one directory up and
remove the subdir reference from @include like this

<%@include file="configuration.jspf" %>

everything works again. So there seems to be a problem with the path resolution
of sorts related to /WEB-INF, introduced by a change in 9.0.67. Unfortunately,
this renders our apps incompatible with 9.0.67 currently, and we use that
mechanism all over the place, the above is just a simplified example.

Note that the above behaviour seems to be restricted to files underneath
WEB-INF only, subdir inclusions in the root dir seem to work ok. still.

It would be great if someone could have a look at this, I'm fairly sure this
affects a larger crowd too.


Thank you,
-- Christian.

-- 
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 66285] <%@include directive fails to include files in subdirectories underneath WEB-INF since 9.0.67

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

Han Li <li...@apache.org> changed:

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

--- Comment #1 from Han Li <li...@apache.org> ---
duplicate: https://bz.apache.org/bugzilla/show_bug.cgi?id=66277

Fixed in:
- 10.1.x for 10.1.1 onwards
- 10.0.x for 10.0.27 onwards
-  9.0.x for  9.0.68 onwards

-- 
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