|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
For every usage of Ant class api, different class loaderHi,
When we are using Ant.java/class api Is it possible to explicitly set the new class loader, even if the initial classes existed in system classloader( i.e though classpath or in ant lib directory.) The issue we are seeing is when we load our custom tasks though taskdef, new classloader is being used for every programmatic ant call there fore static blocks are reinitialised for every sub ant project, however when when we put it in lib or in system classpath, distinct classloader is not used..hence we have issue with some static code :) not being reinitialized. Once we understand classloder behaviors in ant based on project vs subproject and TaskDef classpath way and systemclasspath way, then we could be more confident to fix the current issue. Looking for experts help. Regards, Raja Nagendra Kumar, C.T.O www.tejasoft.com |
|
|
Re: For every usage of Ant class api, different class loaderOn 2009-11-05, Raja Nagendra Kumar <Nagendra.Raja@...> wrote:
> When we are using Ant.java/class api Is it possible to explicitly set the > new class loader, even if the initial classes existed in system classloader( > i.e though classpath or in ant lib directory.) > > The issue we are seeing is when we load our custom tasks though taskdef, new > classloader is being used for every programmatic ant call there fore static > blocks are reinitialised for every sub ant project, however when when we > put it in lib or in system classpath, distinct classloader is not > used..hence we have issue with some static code :) not being reinitialized. Don't use static blocks 8-) Alternatively, don't make your jars available in the system classloader or use the (deprecated) reverseloader attribute of taskdef. > Once we understand classloder behaviors in ant based on project vs > subproject and TaskDef classpath way and systemclasspath way, then we could > be more confident to fix the current issue. It doesn't have any real relation to subprojects at all. Ant normally delegates loading of any classes up the classloader chain. Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: For every usage of Ant class api, different class loaderHi Stefan,
I was waiting for you replies.. all these days.. Thank you for answering this.. >Don't use static blocks 8-) Sure we shall change this. >Alternatively, don't make your jars available in the system classloader This we have to put it in system class loader as we started using the Custom Executor for the purpose of Virtual Targets handling. If ant could consider such needs, and expose a property approach as in the feature request.. http://old.nabble.com/Feature-Request---Executor-setting-though-the-script-td26208582.html we could avoid it. I would appricate your comments on this feature. >or use the (deprecated) reverseloader attribute of taskdef. ok, in this approach, could you pl. let me know how this attribute change the class loading.. and its impact with static blocks > subproject and TaskDef classpath way and systemclasspath way, then we could When we give a jar both in TaskDef classpath inner task and also in system classpath, would the class be loaded from system or from taskdef classpath. Regards, Nagendra |
|
|
Re: For every usage of Ant class api, different class loaderOn 2009-11-05, Raja Nagendra Kumar <Nagendra.Raja@...> wrote:
> I was waiting for you replies.. all these days.. Thank you for answering > this.. Unless I'm mistaken there has been less than four hours between your mail and my response ... Please understand that I work on open source projects on my free time like early mornings (when I reponded to your mail) or my lunchbreak (right now) and that Ant is not the only project I work on. >> or use the (deprecated) reverseloader attribute of taskdef. > ok, in this approach, could you pl. let me know how this attribute change > the class loading.. and its impact with static blocks Usually when you have a nested classpath Ant will still consult the system classloader before the classpath you've specified when trying to load a class (this usually is what you want). If you set reverseloader to true it will look into the specified classpath before consulting the system classloader. Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
RE: For every usage of Ant class api, different class loadercame up on maven users where a build engineer wanted to call a custom task which would load using his provided classloader the only way I knew how to implement any ant task using supplied classloader was for the classloader to create a whole new project (build.xml) (i suspect reverseloader would have at least provided the build engineer the custom classpath he desired) unsure as to all the implications of using custom classloader over default system classloader ? *gruss* Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > From: bodewig@... > To: dev@... > Subject: Re: For every usage of Ant class api, different class loader > Date: Thu, 5 Nov 2009 14:29:41 +0100 > > On 2009-11-05, Raja Nagendra Kumar <Nagendra.Raja@...> wrote: > > > I was waiting for you replies.. all these days.. Thank you for answering > > this.. > > Unless I'm mistaken there has been less than four hours between your > mail and my response ... > > Please understand that I work on open source projects on my free time > like early mornings (when I reponded to your mail) or my lunchbreak > (right now) and that Ant is not the only project I work on. > > >> or use the (deprecated) reverseloader attribute of taskdef. > > > ok, in this approach, could you pl. let me know how this attribute change > > the class loading.. and its impact with static blocks > > Usually when you have a nested classpath Ant will still consult the > system classloader before the classpath you've specified when trying to > load a class (this usually is what you want). If you set reverseloader > to true it will look into the specified classpath before consulting the > system classloader. > > Stefan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > _________________________________________________________________ Hotmail: Trusted email with Microsoft's powerful SPAM protection. http://clk.atdmt.com/GBL/go/177141664/direct/01/ http://clk.atdmt.com/GBL/go/177141664/direct/01/ |
|
|
Re: For every usage of Ant class api, different class loader> Unless I'm mistaken there has been less than four hours between your mail and my response ...
Stefan, I am very impressed by your level of knowledge and your passion to help others. I was really needing your help and hence was very glad to receive your reply. Pl. don't think other wise. Having come out of enterprise like sun and we started this small company 5 years ago around java product refactoring and test automation services. I understand the value of your kind of services. Are u working on Tortoise also.. if yes, how do you manage c++ and java world. Regards, Nagendra |
|
|
Re: For every usage of Ant class api, different class loaderAn other aproach is to specify a loader id when declaring the tasks in the
parent project (and make sure your inherit this id in the subclass). Gilles Scokart 2009/11/5 Stefan Bodewig <bodewig@...> > On 2009-11-05, Raja Nagendra Kumar <Nagendra.Raja@...> wrote: > > > When we are using Ant.java/class api Is it possible to explicitly set the > > new class loader, even if the initial classes existed in system > classloader( > > i.e though classpath or in ant lib directory.) > > > > The issue we are seeing is when we load our custom tasks though taskdef, > new > > classloader is being used for every programmatic ant call there fore > static > > blocks are reinitialised for every sub ant project, however when when we > > put it in lib or in system classpath, distinct classloader is not > > used..hence we have issue with some static code :) not being > reinitialized. > > Don't use static blocks 8-) > > Alternatively, don't make your jars available in the system classloader > or use the (deprecated) reverseloader attribute of taskdef. > > > Once we understand classloder behaviors in ant based on project vs > > subproject and TaskDef classpath way and systemclasspath way, then we > could > > be more confident to fix the current issue. > > It doesn't have any real relation to subprojects at all. Ant normally > delegates loading of any classes up the classloader chain. > > Stefan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > |
|
|
Re: For every usage of Ant class api, different class loaderOn 2009-11-07, Gilles Scokart <gscokart@...> wrote:
> An other aproach is to specify a loader id when declaring the tasks in the > parent project (and make sure your inherit this id in the subclass). IIRC Raja's problem was that static blocks didn't get re-run for projects if the tasks where sharing the same classloader (because the system classloader was used) > On 2009-11-05, Raja Nagendra Kumar <Nagendra.Raja@...> wrote: >> The issue we are seeing is when we load our custom tasks though >> taskdef, new classloader is being used for every programmatic ant >> call there fore static blocks are reinitialised for every sub ant >> project, however when when we put it in lib or in system classpath, >> distinct classloader is not used..hence we have issue with some >> static code :) not being reinitialized. loaderref would make things consistent, but different from what Raja actually wants. Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |