Uploaded image for project: 'Commons FileUpload'
  1. Commons FileUpload
  2. FILEUPLOAD-153

Cannot run unit tests from Ant 1.7.0 (Sun) Java 1.3.1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.2.1
    • 1.2.1
    • None
    • java version "1.3.1_15"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_15-b01)
      Java HotSpot(TM) Client VM (build 1.3.1_15-b01, mixed mode)

      Windows XP 5.1 Service Pack 2 x86-32

    Description

      Cannot run unit tests from Ant 1.7.0 (Sun) Java 1.3.1.

      > From: Jörg Schaible Joerg.Schaible@Elsag-Solutions.com
      > Sent: Thursday, January 10, 2008 10:56 PM
      > To: Jakarta Commons Developers List
      > Subject: RE: [VOTE] Release commons-fileupload 1.2.1 (rc3)
      >
      > Hi Gary,
      >
      > Gary Gregory wrote:
      > > Hello:
      > >
      > > The ant build in this RC fails on Sun Java 1.3.1 [1] because
      > > the unit tests use the XML formatter which depend on W3C
      > > code. The W3C code is in Java 1.4 but not 1.3. The ant build
      > > also reports, apparently non-fatal errors [1] when attempting
      > > to fetch non-existent files out of the maven repos.
      > >
      > > Personally, I no longer care about 1.3.1 but I thought you might like
      > > to know.
      >
      > This can be fixed by adding Xalan 2.7.0 to Ant's lib, but you have to use the one
      > from Apache's Maven repo, not the one from their distribution. Se
      > http://jira.codehaus.org/browse/HAUS-1572

      That does not work for me, no matter what version of Xalan I put in ANT_HOME/lib, I always get:

       
      Using loader null on class org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter: java.lang.NoClassDefFoundError: org/w3c/dom/Node
      	at org.apache.tools.ant.taskdefs.optional.junit.FormatterElement.createFormatter(FormatterElement.java:241)
      	at org.apache.tools.ant.taskdefs.optional.junit.FormatterElement.createFormatter(FormatterElement.java:214)
      	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.transferFormatters(JUnitTestRunner.java:818)
      	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:910)
      	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:766)
      --- Nested Exception ---
      java.lang.NoClassDefFoundError: org/w3c/dom/Node
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:115)
      	at org.apache.tools.ant.taskdefs.optional.junit.FormatterElement.createFormatter(FormatterElement.java:232)
      	at org.apache.tools.ant.taskdefs.optional.junit.FormatterElement.createFormatter(FormatterElement.java:214)
      	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.transferFormatters(JUnitTestRunner.java:818)
      	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:910)
      	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:766)
      

      Then I read:

      http://ant.apache.org/faq.html#junit-no-runtime-xml

      This states that the only way to fix this is to fix one's build.xml file like so:
      "the easiest solution is to add

      <pathelement path="${ant.home}/lib/xml-apis.jar:${ant.home}/lib/xercesImpl.jar"/>
      

      to your task's <classpath>."
      I implemented this and the build succeeded. So I am submitting the attached patch to build.xml. This path element is ignored by Java versions >= 1.4 since one must use the override mechanism to use different XML libs than what is in the runtime.

      Thank you,
      Gary

      Attachments

        1. patch.txt
          0.7 kB
          ggregory@seagullsw.com

        Activity

          People

            Unassigned Unassigned
            ggregory1 Gary Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: