ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 749] New - Class.getResource does not appear to work for java task
Date Wed, 28 Feb 2001 16:58:36 GMT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=749

*** shadow/749	Wed Feb 28 08:58:36 2001
--- shadow/749.tmp.1805	Wed Feb 28 08:58:36 2001
***************
*** 0 ****
--- 1,56 ----
+ +============================================================================+
+ | Class.getResource does not appear to work for java task                    |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 749                         Product: Ant                     |
+ |       Status: NEW                         Version: 1.2                     |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Normal                   OS/Version: AIX                     |
+ |     Priority: Low                       Component: Core tasks              |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: ant-dev@jakarta.apache.org                                   |
+ |  Reported By: ryan_breidenbach@hotmail.com                                 |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ 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">
+     <classpath>
+       <fileset dir="lib">
+         <include name="**/*.jar" />
+       </fileset>
+       <pathelement location="classes" />
+     </classpath>
+   </java>
+ </target>
+ 
+ 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 
+ directory).
+ 
+ However, if I explicitly add the log4j.jar to the classpath of the JVM that 
+ starts, this resource is found:
+ 
+ ...
+ CLASSPATH = $CLASSPATH:$ANT_HOME/lib/log4j.jar
+ export CLASSPATH
+ ...
+ 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.
+ 
+ Thanks.

Mime
View raw message