Bug 50066

Summary: Cannot compile recursive tag with ant if it uses a class from the webapp
Product: Tomcat 6 Reporter: Sylvain Laurent <slaurent>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Severity: major    
Priority: P2    
Version: 6.0.29   
Target Milestone: default   
Hardware: All   
OS: All   
Attachments: patch for trunk (tc7)
patch for tomcat 6

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

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.