This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: define-simple-class and jars on the classpath?


Steve Smith wrote:
On Sun, Aug 27, 2006 at 05:09:13PM +1000, Steve Smith wrote:
  Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at gnu.bytecode.ObjectType.getReflectClass(ObjectType.java:63)
        ... 24 more

Looking at this a bit more, shouldn't ClassExp attempt to load the class before it performs reflection on it (which is what I assume getModifiers() is doing)?

Yep. That's what the Class.forName does.


This does suggest the problem is plain that it cabbot find the Task
class (as opposed to a problem finding or initializing some other
class).

> In that case the following would fail wouldn't it?
>
>     import org.apache.tools.ant.Task;
>     public class AntTest extends Task {
>        public static void main(String []args) {
>               AntTest a = new AntTest();
> 	      System.out.println("Test run: " + a + "\n");
>        }
>     }
>
> But it works here.

(I assume you've run this, rather than just compiling it. )

Try an explicit
   Class.forName("org.apache.tools.ant.Task")
and see if that works.

That is all that Kawa does.  If that runs after compiling
with javac, then the only thing it would appear to be some weird
ClassLoader confusion.  Kawa does:
  Class.forName("xxxx", false, getClass().getClassLoader())
where getClass() returns ObjectType.class.  It's possible that
class's ClassLoader doesn't delegate to the system class loader.

Maybe it's using the boot class laoder, rather than the system
class loader.  (I'm not a ClassLoader expert!)  You can try
getParent() on the ClassLoader returned by etClass().getClassLoader()
to check that.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]