ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38747] New: - Ant class loaders do not prevent delegation in isolated mode when retreiving resources, but do so when loading classes
Date Wed, 22 Feb 2006 05:37:10 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38747>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38747

           Summary: Ant class loaders do not prevent delegation in isolated
                    mode when retreiving resources, but do so when loading
                    classes
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: nandu.k@motorola.com


The AntClassLoader continues to delegate to the parent classloader when 
retreiving resources via the getResource() or getResourceAsStream() APIs, even 
though it blocks this delegation when loading classes. This inconsistency in 
retreiving resources and loading classes leads to issues where the Ant 
distribution provides any service implementations using the Service API 
(specified in the JAR file specification : 
http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider ). A 
good example is the Xerces parser distributed with Ant. It uses the Services 
mechanism to indicate the parser implementation.

The problem arises, for example, when running a Java application that 
instantiates a JAXP parser through an Ant java task. You would run into a 
ParserConfigurationError unless you set fork to true on the java task, or 
included the xerces libraries in the <classpath> element for the java task. 

The reason for this issues appears to be because the Ant classloader created 
for the java task is running in isolated mode. However, it still does delegate 
to the parent classloader (the Ant coreloader) when attempting to retreive 
resources. When instantiating the parser factory, the JAXP implementation 
attempts to locate the right factory to instantiate by searching for (amongst 
other things), the resource META-INF/services/javax.xml.parsers.SAXParserFactory
(DocumentBuilderFactory) in the classpath. This is available to the parent 
coreloader from the xercesImpl.jar in ANT_HOME/lib, and is retreivable by the 
AntClassLoader even in the isolated mode. Next, it attempts to load the Factory 
class, which it fails to do, because it cannot now delegate to the coreloader.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message