ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rainer Noack" <rai...@noacks.net>
Subject RE: Problem with dual classloader.
Date Wed, 25 May 2005 10:06:35 GMT
Hi Tomasz,
could you try the following:
remove classpathref attribute from the typedefs (maybe in this case, the
classloader-ref will be replaced)
or 
remove ALL loaderref attributes and set
<property name="ant.reuse.loader" value="true"/>
prior to your taskdefs and typedefs.
cheers
Rainer

> -----Original Message-----
> From: Siwiec, Tomasz [mailto:Tomasz.Siwiec@sabre.com] 
> Sent: Wednesday, May 25, 2005 10:10 AM
> To: user@ant.apache.org
> Subject: Problem with dual classloader.
> 
> 
> Guys,
> I have my own task and collection implemented and I use it like that:
>     <taskdef name="myTask" classname="com...MyTask" 
> classpathref="std.classpath" loaderref="myTask"/>
>     <typedef name="download_files" classname="com.....AntFileInfoSet"
> classpathref="std.classpath" loaderref="myTask"/>
>     <typedef name="file" classname="com.....AntFileInfo" 
> classpathref="std.classpath" loaderref="myTask"/>
>     ...
>     <myTask .......>        
> 		<download_files id="fl.flieInfos">
>             	<file name="xxx" .../>
>             	<file name="xxx" .../>
>             </download_files> 
>     </myTask>
>     ...
> 
> My task and collection jar file is located at std.classpath. 
> The problem is the AntFileInfoSet class is loaded by 
> different classloader then AnFileInfoSet class defined by 
> section <download_files/>. In that case I always get 
> ClassCastException doing casting in AntFileInfoSet: 
>     public List getAntFileInfos() {
>         if (refid != null) {
>             return ((AntFileInfoSet)
> getProject().getReference(refid)).getAntFileInfos(); !!!!!!
>         } else {
>             return antFileInfos;
>         }
>     }
> 
> In case I copy my jar file to ANT_HOME\lib directory and then 
> run ant, everything is ok as only one classloader is used. As 
> you can see I use loaderref="myTask" property but it doesn't 
> help. Can you help me? Thx, Tomek
> 
> 


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


Mime
View raw message