ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kirk Wylie <>
Subject Use of javax in AntClassLoader.addSystemPackageRoot
Date Wed, 28 Mar 2001 17:21:31 GMT
(This might be the wrong mailing list for this, if it is, I'll send it to

I'm using ANT 1.3 binary distribution, attempting to execute a <java> task
which is built using (and requires in this case) JAXP 1.1. The version of
JAXP which is being distributed with ANT 1.3 appears to be 1.0, if for no
other sign than the jar names (jaxp.jar and parser.jar, rather than
jaxp.jar and crimson.jar as with JAXP 1.1ea2 and final).

When I run a <java> task with a nested classpath and forking set to off, it
creates an AntClassLoader to handle the loading of my classes. These then
correctly find the JAXP 1.1 classes, most of the time.

Because I define an ErrorHandler, first the class loader locates
org.xml.sax.ErrorHandler, which is in my class loader.

Then my class imports and uses javax.xml.parsers.DocumentBuilderFactory and
DocumentBuilder. These are built in the JAXP version I'm using with the 1.1
version of ErrorHandler (inside the AntClassLoader). But because it's
prefixed with javax, the call to addSystemPackageRoot means that:

1) Even though systemFirst is set to false and I'm in isolated mode, if
this class isn't found it will check with the system class loader,
2) Because addSystemPackageRoot is set on "javax", it will NEVER check my
classpath for DocumentBuilder.

Thus although org.xml.sax.ErrorHandler is loaded from my <classpath>, and
DocumentBuilder is very dependant on the version of the org.xml classes
which are distributed as part of JAXP, I am guaranteed never to find the
version of JAXP which is required for this build.

It seems to me that javax.* is something which definitely needs to be
handled differently from java.* in terms of addSystemPackageRoot. I haven't
thought through sufficient issues here, but since this (javax.xml.*) is one
thing which is different depending on which version of the JAXP you're
using, and since it's something which is NOT distributed with the JVM
anyway, there is no ability to call into, without forking, a class which
requires JAXP 1.1.

Am I missing something? I checked the archives and couldn't find anybody
who had this issue.

Kirk Wylie
Kirk Wylie  |  |

View raw message