ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Morris <mike.mor...@coco-technologies.co.za>
Subject Re: Taskdef weirdness - classloader issue?
Date Wed, 08 Jan 2003 11:45:17 GMT
Thanks for the suggestion, but unfortunately it doesn't help.  I end up
with the same result (InvocationTargetException) when both jarfiles are
in some other (non ANT_HOME/lib) directory with an appropriate classpath
setting.

Conor MacNeill wrote:
> Mike Morris wrote:
> 
>> I have an external task defined with a taskdef along the lines of:
>>
>> <taskdef name="foo"
>>     classname="org.foobar.ant.FooTask"
>>     classpathref="build.classpath"
>> />
>>
>> The jarfile containing this task is in ${ant.home}/lib.
>> So far, so good.
>>
> 
> Actually No. Since the Task is in $ANT_HOME/lib the Tas class will be 
> loaded by the system loader (since all jars in ANT_HOME/lib are added to 
> the classpath prior to starting Ant). Since this class is loaded by the 
> taskdef's loader's parent, it cannot see classes available in the child 
> loader.
> 
> Try moving FooTask's jar out of ANT_HOME/lib and then creating a new 
> classpath containing the new loacation and the build.classpath. Use this 
> new path in the taskdef
> 
>> Could some kind soul please point me at where to find out more about 
>> how to use the loaderRef to ensure that all classes are being loaded 
>> by the same classloader, or some other way to resolve/workaround this 
>> issue.
>>
> 
> loaderrefs are there to ensure that multiple taskdefs/typedefs use the 
> same class loader which is not an issue for you since you are only doing 
> one taskdef.
> 
> 
> Conor
> 
> 
> 
> -- 
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
> 
> 

-- 
mike morris
cOcO software - "because you can't reboot the internet"

email: mike.morris (at) coco-technologies . co . za
ph:    (Local) 044 388 4635
         (Int'l) +27 44 388 4635

------- A day without chillies is a day wasted -------




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


Mime
View raw message