Hi Tomasz, I've again taken a look in the source and normally your config should work as expected.
However, there are two more options that you can try out: 1. put all your taskdefs and typedefs in one propertyfile and use the resource-attribute of the taskdef/typedef task. I.e. -----mytasksandtypes.properties----- myTask=com...MyTask downloaf_files=com.....AntFileInfoSet ... ------------------------------------ <typedef resource="mytasksandtypes.properties" classpathref="std.classpath"/> or 2. take a look at the proposed <classloader> task in http://wiki.apache.org/ant/Ant17/Planning resp. http://issues.apache.org/bugzilla/show_bug.cgi?id=28228 . This task is especially designed for those problems. If you go for this option and don't want to build Ant from source, I can send a jar with the task directly to you (not via list). (But this jar should live in ANT_HOME/lib). Regards Rainer > -----Original Message----- > From: Siwiec, Tomasz [mailto:[EMAIL PROTECTED] > Sent: Monday, May 30, 2005 1:39 PM > To: Ant Users List; [EMAIL PROTECTED] > Subject: RE: Problem with dual classloader. > > > Hi Rainer, > Thanks for your help but I still have that problem. > The second solution with <property name="ant.reuse.loader" > value="true"/> seems not to work. I still have different > classloader. However, I don't understand the first > suggestion. In case I will remove classpathref attribute I > will get ClassNotFoundException as "std.classpath" defines > location of my jar file and all required libraries. Of course > I can copy my jar and all libs into ANT_HOME\lib directory > but it is not a way I'd like to solve my problem. Any other > ideas how to force just one classloader? Tomek > > -----Original Message----- > From: Rainer Noack [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 25, 2005 12:07 PM > To: 'Ant Users List' > Subject: RE: Problem with dual classloader. > > 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:[EMAIL PROTECTED] > > Sent: Wednesday, May 25, 2005 10:10 AM > > To: [email protected] > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
