You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Wesley Gamble <w....@pentasafe.com> on 2002/06/05 23:19:29 UTC

JUnitreport task differences between Ant 1.4 and Ant 1.4.1

I am having some problems getting an Ant build file which works fine on 
1.4 to work on 1.4.1.  Within this build file is a junitreport task.  It 
builds fine under Ant 1.4, but not under Ant 1.4.1.

Under Ant 1.4.1, it throws the following error:

C:\Data\Dev\Policy\commons\build.xml:42: java.lang.NoClassDefFoundError: 
org/apache/xalan/xslt/XSLTInputSource
        at 
org.apache.tools.ant.IntrospectionHelper.createElement(IntrospectionHelper.java:342)
        at 
org.apache.tools.ant.ProjectHelper$NestedElementHandler.init(ProjectHelper.java:547)
        at 
org.apache.tools.ant.ProjectHelper$TaskHandler.startElement(ProjectHelper.java:507)
        at 
org.xml.sax.helpers.XMLReaderAdapter.startElement(XMLReaderAdapter.java:329)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1477)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1766)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1766)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1766)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
        at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
        at 
org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:326)
        at org.apache.tools.ant.ProjectHelper.parse(ProjectHelper.java:117)
        at 
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:85)
        at org.apache.tools.ant.Main.runBuild(Main.java:439)
        at org.apache.tools.ant.Main.start(Main.java:153)
        at org.apache.tools.ant.Main.main(Main.java:176)
--- Nested Exception ---
java.lang.NoClassDefFoundError: org/apache/xalan/xslt/XSLTInputSource
        at 
org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator.createReport(XMLResultAggregator.java:114)
        at java.lang.reflect.Method.invoke(Native Method)
        at 
org.apache.tools.ant.IntrospectionHelper$1.create(IntrospectionHelper.java:183)
        at 
org.apache.tools.ant.IntrospectionHelper.createElement(IntrospectionHelper.java:326)
        at 
org.apache.tools.ant.ProjectHelper$NestedElementHandler.init(ProjectHelper.java:547)
        at 
org.apache.tools.ant.ProjectHelper$TaskHandler.startElement(ProjectHelper.java:507)
        at 
org.xml.sax.helpers.XMLReaderAdapter.startElement(XMLReaderAdapter.java:329)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1477)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1766)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1766)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1766)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
        at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
        at 
org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:326)
        at org.apache.tools.ant.ProjectHelper.parse(ProjectHelper.java:117)
        at 
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:85)
        at org.apache.tools.ant.Main.runBuild(Main.java:439)
        at org.apache.tools.ant.Main.start(Main.java:153)
        at org.apache.tools.ant.Main.main(Main.java:176)

I read several posts where people seemed to have similar problems. 
 Indeed, this class is not even in the xalan.jar that you are supposed 
to use in order to make Junitreport work.  

I reduced this down to a sort of reasonable test case to illustrate the 
difference.  Here is the test build file (note that there is only one 
target and no, it would not normally work, but this is just to 
illustrate the problem).

build.xml:
<?xml version="1.0"?>
<!-- 
======================================================================= -->
<!-- Ant own build 
file                                                      -->
<!-- 
======================================================================= -->

<project name="VigilEnt Commons" default="main_full" basedir=".">
    <taskdef name="junit" 
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
    <!--
       
========================================================================
         Run the client JUnit test cases. This target should not be called
         directly. It must be called by a test_XXX target (where XXX is the
         name of the server - see included xml file for different servers)
       
========================================================================
    -->
    <target name="tests" depends="set.class.path" if="class.path">

        <delete>
            <fileset dir="${reports.tests}" />
        </delete>
        <junit printsummary="yes"
               haltonfailure="no"
               haltonerror="no"
               fork="yes">

            <classpath path="${class.path}"/>

            <formatter type="xml" />

            <batchtest fork="yes" todir="${reports.tests}/xml">
                <fileset dir="${build.classes}">
                    <include name="**/Test*.class" />
                </fileset>
            </batchtest>
        </junit>

        <junitreport todir="./junit">
            <fileset dir="./junit/xml">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="frames" todir="./junit/html"/>
        </junitreport>
    </target>
</project>

If run under Ant 1.4 with the following CLASSPATH and run "ant tests":

C:\jdk1.3.1_02\lib\tools.jar
C:\jakarta-ant-1.4\lib\optional.jar
C:\jakarta-ant-1.4\lib\junit.jar
C:\jakarta-ant-1.4\lib\jaxp.jar
C:\jakarta-ant-1.4\lib\crimson.jar
C:\jakarta-ant-1.4\lib\ant.jar

you get the expected complaint about the set.class.path target not being 
there since this is, effectively, a fragment of a build.xml file.

However, if you simply switch to Ant 1.4.1 with the following CLASSPATH 
and run "ant tests":

C:\jdk1.3.1_02\lib\tools.jar
C:\jakarta-ant-1.4.1\lib\jaxp.jar
C:\jakarta-ant-1.4.1\lib\crimson.jar
C:\jakarta-ant-1.4.1\lib\ant.jar
C:\jakarta-ant-1.4.1\lib\ant-optional.jar

you get the exception shown above.  Note that I don't even have Xalan or 
Xerces JAR in my CLASSPATH - their presence doesn't change anything 
(their absence would matter if Ant ever got to trying to execute one of 
these targets).  This exception is thrown before any target processing 
is attempted.

I have tried making sure that xerces.jar in the CLASSPATH before 
crimson.jar and it doesn't help.

If anyone understands what is going on here with the parsing, please 
share.  I think there is some very subtle parsing issue here and this 
exception is a red herring.

Thanks for any help,
Wes Gamble
w.gamble@pentasafe.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JUnitreport task differences between Ant 1.4 and Ant 1.4.1

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Wesley Gamble" <w....@pentasafe.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Cc: <w....@pentasafe.com>; <s....@pentasafe.com>;
<t....@pentasafe.com>
Sent: Wednesday, June 05, 2002 4:44 PM
Subject: Re: JUnitreport task differences between Ant 1.4 and Ant 1.4.1


> Steve,
>
> Thanks for your post.
>
> So are you saying that if my Xalan 2 stuff is not in order (i.e. correct
> libs in CLASSPATH, which according to docs. are Xalan.jar, Xerces.jar,
> and bsf.jar), then this error will be thrown?
> I added these JARS into my CLASSPATH and reran my test and got the same
> error, so that doesn't seem to help.

put them in the ant lib dir

>
> In my original test case, I removed any Xalan jar configuration
> whatsoever.  Why does it _not_ break for v. 1.4 but does for v.1.4.1?
> In 1.4.1, I guess this "checking for Xalan 2 and then defaulting to
> Xalan 1" code got added?

I have no idea :)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JUnitreport task differences between Ant 1.4 and Ant 1.4.1

Posted by Wesley Gamble <w....@pentasafe.com>.
Steve,

Thanks for your post.

So are you saying that if my Xalan 2 stuff is not in order (i.e. correct 
libs in CLASSPATH, which according to docs. are Xalan.jar, Xerces.jar, 
and bsf.jar), then this error will be thrown?
I added these JARS into my CLASSPATH and reran my test and got the same 
error, so that doesn't seem to help.

In my original test case, I removed any Xalan jar configuration 
whatsoever.  Why does it _not_ break for v. 1.4 but does for v.1.4.1?  
In 1.4.1, I guess this "checking for Xalan 2 and then defaulting to 
Xalan 1" code got added?  

Wes

Steve Loughran wrote:

>----- Original Message -----
>From: "Wesley Gamble" <w....@pentasafe.com>
>To: <an...@jakarta.apache.org>
>Cc: <w....@pentasafe.com>
>Sent: Wednesday, June 05, 2002 2:19 PM
>Subject: JUnitreport task differences between Ant 1.4 and Ant 1.4.1
>
>>I am having some problems getting an Ant build file which works fine on
>>1.4 to work on 1.4.1.  Within this build file is a junitreport task.
>>It builds fine under Ant 1.4, but not under Ant 1.4.1.
>>
>
>As is usual in these situations, can you try ant1.5beta2 to see if
>helps/changes your problem.
>
>
>>Under Ant 1.4.1, it throws the following error:
>>
>>C:\Data\Dev\Policy\commons\build.xml:42:
>>
>java.lang.NoClassDefFoundError:
>
>>org/apache/xalan/xslt/XSLTInputSource
>>
>
>I am surprised you got this, certainly in the latest code there are
>meant to
>be routines to catch this.
>
>
>>I read several posts where people seemed to have similar problems.
>> Indeed, this class is not even in the xalan.jar that you are supposed
>>to use in order to make Junitreport work.
>>
>
>no, but it is in Xalan1
>
>>you get the exception shown above.  Note that I don't even have Xalan
>>
>or
>
>>Xerces JAR in my CLASSPATH - their presence doesn't change anything
>>(their absence would matter if Ant ever got to trying to execute one
>>
>of
>
>>these targets).  This exception is thrown before any target processing
>>is attempted.
>>
>
>the exception is thrown as the junit stuff is built, and at that time it
>looks for xalan2, then xalan1. If you had xalan2 then you should not see
>it.
>
>
>
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JUnitreport task differences between Ant 1.4 and Ant 1.4.1

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Wesley Gamble" <w....@pentasafe.com>
To: <an...@jakarta.apache.org>
Cc: <w....@pentasafe.com>
Sent: Wednesday, June 05, 2002 2:19 PM
Subject: JUnitreport task differences between Ant 1.4 and Ant 1.4.1


> I am having some problems getting an Ant build file which works fine on
> 1.4 to work on 1.4.1.  Within this build file is a junitreport task.  It
> builds fine under Ant 1.4, but not under Ant 1.4.1.
>

As is usual in these situations, can you try ant1.5beta2 to see if
helps/changes your problem.


> Under Ant 1.4.1, it throws the following error:
>
> C:\Data\Dev\Policy\commons\build.xml:42: java.lang.NoClassDefFoundError:
> org/apache/xalan/xslt/XSLTInputSource

I am surprised you got this, certainly in the latest code there are meant to
be routines to catch this.


> I read several posts where people seemed to have similar problems.
>  Indeed, this class is not even in the xalan.jar that you are supposed
> to use in order to make Junitreport work.

no, but it is in Xalan1

>
> you get the exception shown above.  Note that I don't even have Xalan or
> Xerces JAR in my CLASSPATH - their presence doesn't change anything
> (their absence would matter if Ant ever got to trying to execute one of
> these targets).  This exception is thrown before any target processing
> is attempted.

the exception is thrown as the junit stuff is built, and at that time it
looks for xalan2, then xalan1. If you had xalan2 then you should not see it.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>