You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Antoine Levy-Lambert <an...@gmx.de> on 2006/08/22 15:58:34 UTC

classloader and delegating classloader problem

Hello Peter and other,

does this <classloader/> task address the delegating class loader issue ?

I am really not knowledgeable about classloaders myself, but remember that I was not able to make a custom task based on JNDI APIs work if the concrete JNDI driver to use (in this case it was a JNDI driver for MQ Series) was not put on the classpath before starting ant. I guess that the explanation in this case is that my custom task invokes the standard JNDI APIs (Context class) which is implemented in the Java runtime, and that this one cannot find the classloader which loaded my task anymore, so does not know about the JNDI driver.

Would be cool if <classloader/> solves the problem.

Regards,

Antoine

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


Re: classloader and delegating classloader problem

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Cool.

Regards,

Antoine
-------- Original-Nachricht --------
Datum: Tue, 22 Aug 2006 16:17:59 +0100
Von: "Peter Reilly" <pe...@gmail.com>
An: "Ant Developers List" <de...@ant.apache.org>
Betreff: Re: classloader and delegating classloader problem

> I do not know if it solves this problem, but I think that it does.
> (but at a cost - this is not standard use of classloaders, the
> code uses reflection to access protected methods of URLClassloader).
> Peter
> 
> 
> On 8/22/06, Antoine Levy-Lambert <an...@gmx.de> wrote:
> >
> > Hello Peter and other,
> >
> > does this <classloader/> task address the delegating class loader issue
> ?
> >
> > I am really not knowledgeable about classloaders myself, but remember
> that
> > I was not able to make a custom task based on JNDI APIs work if the
> concrete
> > JNDI driver to use (in this case it was a JNDI driver for MQ Series) was
> not
> > put on the classpath before starting ant. I guess that the explanation
> in
> > this case is that my custom task invokes the standard JNDI APIs (Context
> > class) which is implemented in the Java runtime, and that this one
> cannot
> > find the classloader which loaded my task anymore, so does not know
> about
> > the JNDI driver.
> >
> > Would be cool if <classloader/> solves the problem.
> >
> > Regards,
> >
> > Antoine
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> > For additional commands, e-mail: dev-help@ant.apache.org
> >
> >

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


Re: classloader and delegating classloader problem

Posted by Peter Reilly <pe...@gmail.com>.
I do not know if it solves this problem, but I think that it does.
(but at a cost - this is not standard use of classloaders, the
code uses reflection to access protected methods of URLClassloader).
Peter


On 8/22/06, Antoine Levy-Lambert <an...@gmx.de> wrote:
>
> Hello Peter and other,
>
> does this <classloader/> task address the delegating class loader issue ?
>
> I am really not knowledgeable about classloaders myself, but remember that
> I was not able to make a custom task based on JNDI APIs work if the concrete
> JNDI driver to use (in this case it was a JNDI driver for MQ Series) was not
> put on the classpath before starting ant. I guess that the explanation in
> this case is that my custom task invokes the standard JNDI APIs (Context
> class) which is implemented in the Java runtime, and that this one cannot
> find the classloader which loaded my task anymore, so does not know about
> the JNDI driver.
>
> Would be cool if <classloader/> solves the problem.
>
> Regards,
>
> Antoine
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

RE: classloader and delegating classloader problem

Posted by Rainer Noack <ra...@noacks.net>.
Should work, but these issues typically require manipulation of the System
Classloader (resp. User-Classloader).
In Ant, this is the Launcher's Classloader whereas oata.Main, oata.Project
and the rest are loaded via a  System Classloader's childloader. As
discussed in this list some years ago, it may produce curious results if a
class is added to a parent-loader after it is used/load by a childloader.
Handle with care!!!
One can use <classloaderreport/> to debug classloader related issues.

Cheers 

Rainer


> -----Original Message-----
> From: Antoine Levy-Lambert [mailto:antoine@gmx.de] 
> Sent: Tuesday, August 22, 2006 3:59 PM
> To: dev@ant.apache.org
> Subject: classloader and delegating classloader problem
> 
> 
> Hello Peter and other,
> 
> does this <classloader/> task address the delegating class 
> loader issue ?
> 
> I am really not knowledgeable about classloaders myself, but 
> remember that I was not able to make a custom task based on 
> JNDI APIs work if the concrete JNDI driver to use (in this 
> case it was a JNDI driver for MQ Series) was not put on the 
> classpath before starting ant. I guess that the explanation 
> in this case is that my custom task invokes the standard JNDI 
> APIs (Context class) which is implemented in the Java 
> runtime, and that this one cannot find the classloader which 
> loaded my task anymore, so does not know about the JNDI driver.
> 
> Would be cool if <classloader/> solves the problem.
> 
> Regards,
> 
> Antoine
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 


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