Bug 53032 - Ant Jasper task fails to run when using XML namespaces; no output; no errors
Summary: Ant Jasper task fails to run when using XML namespaces; no output; no errors
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 6.0.35
Hardware: All All
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2012-04-03 21:41 UTC by Nick Williams
Modified: 2012-06-24 11:43 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Nick Williams 2012-04-03 21:41:35 UTC
One way to use bulk task definitions in Ant is to use XML namespaces:

<project name="teamcity"


    <path id="tomcat.6.ant.classpath">
        <fileset dir="${my.path.library.build}/tomcat-6.0.35">
            <include name="*.jar" />
        <path refid="my.path.compile.jsp" />

    <typedef resource="org/apache/catalina/ant/antlib.xml"
             classpathref="tomcat.6.ant.classpath" />


        <tomcat6:list ... />
        <tomcat6:deploy ... />


This works great for list, deploy, etc. In fact, it works great for every other Ant task as far as I can tell. But it doesn't work for the jasper/jasper2 tasks (which both point to the same class).

<tomcat6:jasper ... />

This does nothing. And by “nothing” I mean that I use `ant -verbose` when running Ant, verbose=”1” within the Jasper task, and there’s no output from the Jasper task, not a single line of output/logging, and the build completes in 0 seconds with no compiled JSPs output.

However, if I define the Jasper task explicitly, using the exact same paths (as you can clearly see):
    <taskdef classname="org.apache.jasper.JspC" name="tomcat6-jsp-compile">
            <path refid="tomcat.6.ant.classpath" />
And call the Jasper task using the exact same options:
<tomcat6-jsp-compile ... />
Everything works. It compiles 2,487 JSPs in 275s, and outputs exactly what I expect, including 2,487 compiled JSPs and two logging messages. From what I understand about Ant, there should be absolutely no difference, and yet there apparently is, because they behave differently.

The jasper task should support namespaces like the other Tomcat Ant tasks, and like other Ant tasks in general.

(Note: I have confirmed at http://ant.apache.org/faq.html that a separate classloader IS used for the taskdef, and that Jspc will not have access to conflicting classes loaded by other namespaces.)
Comment 1 Nick Williams 2012-04-03 22:07:09 UTC
Relevant to 53011, 53012, 53031 and 53032: Per discussions with Chris Schultz in the users list, we agree that it would probably make more sense to separate the Ant task from the JspC class and place a new Ant task in the o.a.catalina.ant package (possibly o.a.catalina.ant.jasper?). Research about the state of the task needs to be completed. Further discussions about this will take place in the developer's list, and then these issues will be updated when a consensus is reached.
Comment 2 Nick Williams 2012-04-04 15:18:54 UTC
Since JspC is the only Tomcat Ant task that doesn't work with namespaces, and JspC is also the only Tomcat Ant task that /doesn't/ extend o.a.tools.ant.Task, it seems likely that is the culprit. I don't know this for sure, but from my initial examination of all of the code involved, it appears that is the case.

JspC doesn't extend or implement /any/ Ant classes. As far as Ant goes, it appears to purely be a hacked-together class that just happens to implement the minimum methods that Ant expects a task to implement, and this can run as a task. But it is not, as for as Ant is concerned, an actual Task. It seems very unlikely that something other than this fact is causing this issue.
Comment 3 Mark Thomas 2012-06-05 23:02:24 UTC
Confirmed. Extending Task does fix this.

I'm not convinced that it makes sense to separate the Ant task and JspC. While the current approach isn't the one I'd select if starting from a clean sheet, I don't see a compelling argument to change it now.

Fixed in trunk and 7.0.x and will be included in 7.0.28 onwards.

Proposed for 6.0.x
Comment 4 Konstantin Kolinko 2012-06-24 11:43:54 UTC
Fixed in 6.0 with r1353247 and will be in 6.0.36.