Bug 50066 - Cannot compile recursive tag with ant if it uses a class from the webapp
Summary: Cannot compile recursive tag with ant if it uses a class from the webapp
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 6.0.29
Hardware: All All
: P2 major (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-09 09:49 UTC by Sylvain Laurent
Modified: 2010-10-14 10:48 UTC (History)
0 users



Attachments
patch for trunk (tc7) (999 bytes, patch)
2010-10-09 09:52 UTC, Sylvain Laurent
Details | Diff
patch for tomcat 6 (1011 bytes, patch)
2010-10-09 09:53 UTC, Sylvain Laurent
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain Laurent 2010-10-09 09:49:32 UTC
The following simple tag file cannot be compiled with the jspc ant task (or the jpsc maven plugin) :

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>

Hello world !
<c:if test="${false}" >
    <tags:recursive />
</c:if>

The error is 
org.apache.jasper.JasperException: /WEB-INF/tags/recursive.tag(21,0) Unable to load tag handler class "org.apache.taglibs.standard.tag.rt.core.IfTag" for tag "c:if"

It's OK when the compilation is done "online", when the first jsp that uses this tag is called with a http request.

The problem is that japer's TagFileProcessor does not set the correct classloader when compiling recursive tags. It works in online mode because the parent classloader of the jsp classloader is the webapp classloader.
Comment 1 Sylvain Laurent 2010-10-09 09:52:48 UTC
Created attachment 26148 [details]
patch for trunk (tc7)

The issue occurs both in tomcat 6 and 7
Comment 2 Sylvain Laurent 2010-10-09 09:53:21 UTC
Created attachment 26149 [details]
patch for tomcat 6
Comment 3 Mark Thomas 2010-10-10 14:18:00 UTC
Thanks for the patches.

Patch applied to trunk and will be included in 7.0.4 onwards.

Patch proposed for 6.0.x.
Comment 4 Mark Thomas 2010-10-14 10:48:16 UTC
Fixed in 6.0.x and will be in 6.0.30 onwards.