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
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>