Bug 749

Summary: Class.getResource does not appear to work for java task
Product: Ant Reporter: ryan_breidenbach
Component: Core tasksAssignee: Ant Notifications List <notifications>
Severity: normal    
Priority: P5    
Version: 1.2   
Target Milestone: ---   
Hardware: PC   
OS: AIX   

Description ryan_breidenbach 2001-02-28 08:58:35 UTC
The ClassLoader that is being used for Ant's java task does not appear to 
implement the getResource method correctly.

I was using Ant (version 1.2) to run a test class with the folling XML in the 
build.xml file:

<target name="log_test">
  <java classname="com.michaels.framework.logging.LogManagerTest">
      <fileset dir="lib">
        <include name="**/*.jar" />
      <pathelement location="classes" />

The class that calls the GetResource method is actually a class in the log4j 
project, org.apache.log4j.xml.DOMConfigurator. It calls this method to locate 
the log4j.dtd file. This file resides in the lo4j.jar JAR file 
at /org/apache/log4j/xml/log4j.dtd. And this class file is loaded according to 
the <classpath> attribute of my tash (log4j.jar resides in my {build_home)/lib 

However, if I explicitly add the log4j.jar to the classpath of the JVM that 
starts, this resource is found:

java ... org.apache.tool.ant.Main ...

This leads me to believe that file the ClassLoader that load's Ant's class 
files (I assume the System ClassLoader) implements the getResource method 
correctly, while the ClassLoader used by Ant's java task does not.

Let me know if I can clarify anything else.

Comment 1 ryan_breidenbach 2001-02-28 14:35:03 UTC
This bug appears to be related to bug 353:

Comment 2 Conor MacNeill 2001-05-09 08:00:02 UTC
*** Bug 1659 has been marked as a duplicate of this bug. ***
Comment 3 Conor MacNeill 2001-05-09 08:01:23 UTC
Just to be clear this bug is not really related to bug 353
Comment 4 Conor MacNeill 2001-05-09 08:21:32 UTC
Fixed with a patch from Markus Lauer <Markus.Lauer@extern-sis-west.de>
Comment 5 Sean Rohead 2001-05-09 13:52:49 UTC
*** Bug 1440 has been marked as a duplicate of this bug. ***