You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jeremy Mawson <jm...@dialectsolutions.com> on 2002/11/08 12:23:42 UTC

Optional Task JUnit - unable to instantiate DocumentBuilderFactor yImpl 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.

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?

The exact error seen is:

execute-pure-tests:
    [junit] javax.xml.parsers.FactoryConfigurationError:
com.sun.xml.parser.DocumentBuilderFactoryImpl
    [junit] 	at
javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.
java:75)
    [junit] 	at
org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.getDocu
mentBuilder(XMLJUnitResultFormatter.java:93)
    [junit] 	at
org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.startTe
stSuite(XMLJUnitResultFormatter.java:138)
    [junit] 	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.fireStartTestSu
ite(JUnitTestRunner.java:433)
    [junit] 	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:279)
    [junit] 	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:524)
    [junit] Exception in thread "main" 
    [junit] TEST
com.qsipayments.business.authentication.AuthenticationCounterTest FAILED

I hope someone can help shed some light on this for me. Thanks for reading
this far. :) 

Regards
Jeremy Mawson

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


Re: Optional Task JUnit - unable to instantiate DocumentBuilderFactoryImpl since upgrading to 1.5.1

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Jeremy Mawson" <jm...@dialectsolutions.com>
To: "'Ant Users List'" <an...@jakarta.apache.org>
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>