Hi Jeremy,

JDK 1.4 includes an XML parser (some version of Xerces, I think) and
JAXP APIs in the runtime libs.

I just ran my JUnit tests with JDK 1.3.1_05, Ant 1.5.1 and XML format
output, and formatted the results with Xalan and <junitreport>.  No
problems.  Here are my relevant settings:

<junit printsummary="yes" dir="${basedir}/lib" fork="yes">
  <jvmarg value="-Dtest.data.dir=${test.data.dir}"/>
  <formatter type="xml" extension=".xml"/>
[etc.]

And for junitreport I just have:

<junitreport todir="${junit.reports}"> 
  <fileset dir="${junit.reports}"> 
    <include name="TEST-*.xml"/> 
  </fileset> 
  <report format="frames" todir="${junit.reports}/html"/> 
</junitreport> 

In ANT_HOME/lib as far as XML-related libs go, I have:
crimson.jar
jaxp.jar
xalan.jar
xercesImpl.jar
xml-apis.jar

No CLASSPATH settings, nothing in my JAVA_HOME/jre/lib/ext and no
special JVM args or jaxp.properties.

Why do I have two parsers and two sets of jaxp/XML API interfaces in
ANT_HOME/lib?  Really because some tasks/tools require different parsers
and these seem to all play together fine without any conflicts.  

FWIW, I was able to reproduce DocumentBuilder-related exceptions if I
put an older version of xerces.jar (downloaded directly from the Xerces
project) in ANT_HOME/lib, instead of the xercesImpl.jar that comes with
Ant 1.5.1.

Scott Stirling


> -----Original Message-----
> From: Jeremy Mawson [mailto:jmawson@;dialectsolutions.com] 
> Sent: Monday, November 11, 2002 10:15 PM
> To: 'Ant Users List'
> Subject: RE: Optional Task JUnit - unable to instantiate 
> DocumentBuilderFactoryImpl since upgrading to 1.5.1
> 
> 
> Thank you Steve for your response.
> 
> I've forked the junit tasks as you suggest, and I've also 
> explicity declared Xerces in the classpath for the junit 
> tasks. However, neither of these suggestions changed the error.
> 
> I played around for a bit longer and discovered all I need to 
> do to resolve the issue is to upgrade Java to 1.4.1. However, 
> this is not a suitable solution as I need the ant build to 
> run with 1.3 also. So, what might be different between 1.3 
> and 1.4 that would cause such an error?
> 
> Has anyone else encountered problems when using JUnit XML log 
> formatting via Ant 1.5.1 with Java 1.3.1?
> 
> Regards
> Jeremy
> 
> 
> > -----Original Message-----
> > From: Steve Loughran [mailto:steve_l@;iseran.com]
> > Sent: Saturday, 9 November 2002 6:24 AM
> > To: Ant Users List
> > Subject: Re: Optional Task JUnit - unable to instantiate 
> > DocumentBuilderFactoryImpl since upgrading to 1.5.1
> > 
> > 
> > 
> > ----- Original Message -----
> > From: "Jeremy Mawson" <[EMAIL PROTECTED]>
> > To: "'Ant Users List'" <[EMAIL PROTECTED]>
> > Sent: Friday, November 08, 2002 3:23 AM
> > Subject: Optional Task JUnit - unable to instantiate 
> > DocumentBuilderFactoryImpl since upgrading to 1.5.1
> > 
> > 
> > > Greetings
> > >
> > > I have been successfully using the Ant optional junit task
> > in my builds
> > for
> > > some time now. Recently we upgraded Ant to version 1.5.1
> > and suddenly
> > junit
> > > is no longer able to provide XML formatted test results.
> > I've spent around
> > 6
> > > hours RTM'ing, STW'ing, sourcecode-reading and 
> head-scratching to no
> > avail,
> > > so I've come here for help.
> > >
> > > The Ant logging indicates that the junit task wishes to
> > instantiate a
> > > com.sun.xml.parser.DocumentBuilderFactoryImpl, but is
> > unable to do so.
> > AFAIK
> > > this particular class exists in parser.jar, which is
> > neither distributed
> > > with Ant nor recommended in the Library Dependencies
> > section of the Ant
> > > manual.
> > 
> > com.sun stuff tends to exist in java runtimes, but the
> > non-forking <java>
> > executor in ant1.5.1 doesnt export it to subclasses.
> > 
> > >
> > > Notably another implementation
> > > (org.apache.xerces.jaxp.DocumentBuilderFactoryImpl) is
> > distributed in
> > > xercesImpl.jar. I read on the JUnit site that you can force
> > the use of a
> > > different implementation by creating/modifying
> > jaxp.properties under the
> > > JRE's lib dir. However when I set the property 
> > > javax.xml.parsers.DocumentBuilderFactory to 
> > > org.apache.xerces.jaxp.DocumentBuilderFactoryImpl Ant
> > failed to execute at
> > > all.
> > >
> > > Is the xercesImpl version of the DocumentBuilderFactoryImpl
> > the one I will
> > > eventually require?
> > > If so, how can I enable Ant to find this version?
> > 
> > I'm not sure that is the right approach to fixing this, since
> > it is probably
> > a classloader issue.
> > 
> > 1. set fork=true
> > 2. explicitly include the xerces libs in your junit path.



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@;jakarta.apache.org>

Reply via email to