ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoying, Ken" <KHoy...@tiaa-cref.org>
Subject RE: Class loader problem
Date Thu, 22 Sep 2005 19:21:16 GMT
I have been playing around with the <classloader> task but have not had much luck.

I keep getting the following error:

java.lang.VerifyError: (class: org/apache/tools/ant/types/URLPath, method: dieOnCircularReference
signature: (Ljava/util/Stack;Lorg/apache/tools/ant/Project;)V) Bad access to protected data

Any ideas?

Thanks in advvance!
Ken

-----Original Message-----
From: Rainer Noack [mailto:rainer@noacks.net]
Sent: Friday, September 16, 2005 3:29 PM
To: 'Ant Users List'
Subject: RE: Class loader problem


Hi Ken,
If you use <taskdef/> with a classpath, the task will be loaded by a 
newly created classloader that uses the project classloader as delegation
classloader.
(if you're using the distributed launch scripts, the project classloader is
a delegation
child of the System classloader). 
The distributed task - as well as the common Ant classes - are loaded by the
project
classloader. If the delegation child for your (older) task looks for the
task's class,
it finds the newer version (with the same classname) in it's delegation
parent which takes 
precedence over the class in the delegation child.

I don't have a "clean" out-of-the-box solution for your problem but you have
some options to play with. 
Their success depends mostly on your task dependencies. In every case, you
should make sure
that the jar with the old version of your task don't affect other tasks.

1. try the - highly deprecated and not longer documented - taskdef
attribute: reverseLoader="true"

2. inject your jar in project classloader's classpath prior to the jars in
$ANT_HOME/lib 
   by setting CLASSPATH=my_older_jar env variable
   (maybe putting into $USER_HOME/.ant/lib or using the -lib option might
have the same effect but i'm not sure)

3. define your (old) build jar as a system extension via
ANT_OPTS="-Djava.ext.dirs=path_to_dir"

To get more information about the classloader stuff in your build, you might
want to test <classloaderreport>
which is available under http://jtools.org/ant-classloadertask/
(It is proposed as a CoreTask in Ant 1.7.)

There you will also find <classloader> that allows you one more dirty
solution:

4. add your jar to the system-classloader's classpath via the <classloader>
task.

Hope that helps a little bit
Cheers
Rainer

> -----Original Message-----
> From: Hoying, Ken [mailto:KHoying@tiaa-cref.org] 
> Sent: Friday, September 16, 2005 5:53 PM
> To: user@ant.apache.org
> Subject: Class loader problem
> 
> 
> 
> I am having a class loading problem with Ant.  We have a 
> standard Ant distribution which includes a jar file with a 
> v1.1 of a task in the Ant distribution's lib directory.  
> However, our project is still using the 1.0 version of this 
> task.  I have included the jar with the 1.0 version of the 
> task in my build lib and have set a path to that build lib.  
> I have referenced that path in classpathref attribute of the 
> taskdef.  However, no matter what I seem to do, Ant always 
> seems to load the taskdef from the Ant lib jar instead of 
> from the build lib jar.
> 
> Any help would be greatly appreciated.
> 
> Thank you,
> Ken Hoying
> 
> 
> 
> 
> **************************************************************
> This message, including any attachments, contains 
> confidential information intended for a specific individual 
> and purpose, and is protected by law.  If you are not the 
> intended recipient, please contact sender immediately by 
> reply e-mail and destroy all copies.  You are hereby notified 
> that any disclosure, copying, or distribution of this 
> message, or the taking of any action based on it, is strictly 
> prohibited. TIAA-CREF
> **************************************************************
> 
> 


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



**************************************************************
This message, including any attachments, contains confidential information intended for a
specific individual and purpose, and is protected by law.  If you are not the intended recipient,
please contact sender immediately by reply e-mail and destroy all copies.  You are hereby
notified that any disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.
TIAA-CREF
**************************************************************


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


Mime
View raw message