ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wiedmann <jochen.wiedm...@freenet.de>
Subject Unresolved compilation problem - why?
Date Fri, 02 Jul 2004 09:25:55 GMT

Hi,

I have a custom Ant task, that works with reflection. The Ant task is loaded 
over a ClassLoader created with the "path" type. Now, my code looks like this:

     // The ClassLoader is the AntClassLoader used to load the custom Ant
     // task. It is also used to instantiate the class pClass.
     ClassLoader cl = pClass.getClassLoader();
     try {
         cl.loadClass("com.sag.justus.vo.Schema");
         System.err.println("Successful load of Schema class");
     } catch (Throwable t) {
         t.printStackTrace();
     }
     try {
         pClass.newInstance();
         System.err.println("Successful instantiation");
     } catch (Throwable t) {
         t.printStackTrace();
     }

The output looks as follows. Note, that the output claims, that the class 
com.sag.justus.vo.Schema cannot be imported into the constructor of pClass, 
although that classes ClassLoader can very well load that class.

Any ideas, what might be wrong? Or what I can do for further debugging the 
problem?


Jochen


     [jaxme] Successful load of Schema class
     [jaxme] java.lang.Error: Unresolved compilation problems:
     [jaxme]     The import com.sag.justus.vo.Schema cannot be resolved
     [jaxme]     Schema cannot be resolved
     [jaxme]     Schema cannot be resolved
     [jaxme]     Schema cannot be resolved
     [jaxme]     Schema cannot be resolved

     [jaxme]     at 
com.sag.justus.server.query.view.QueryOffeneStatistikFG.<init>(QueryOffeneStatistikFG.java:6)
     [jaxme]     at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     [jaxme]     at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     [jaxme]     at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     [jaxme]     at 
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
     [jaxme]     at java.lang.Class.newInstance0(Class.java:308)
     [jaxme]     at java.lang.Class.newInstance(Class.java:261)
     [jaxme]     at 
com.sag.justus.generator.QuerySchemaReader.getElement(QuerySchemaReader.java:68)

Die unterste Zeile ist der obige Quelltext. Mit anderen Worten: Ich kann 
über den ClassLoader die Klasse Schema laden. Ich kann aber nicht beim 
Instanziieren der Klasse über den selben ClassLoader dieselbe Klasse 
importieren?


Gruß,

Jochen


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


Mime
View raw message