ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Morris <mike.mor...@coco-technologies.co.za>
Subject Taskdef weirdness - classloader issue?
Date Tue, 07 Jan 2003 13:07:33 GMT
I have an external task defined with a taskdef along the lines of:

<taskdef name="foo"
     classname="org.foobar.ant.FooTask"
     classpathref="build.classpath"
/>

The jarfile containing this task is in ${ant.home}/lib.
So far, so good.

However FooTask depends on another set of classes in a different library 
"foobar.jar", and the build terminates with

	java.lang.ClassNotFoundException: org.foobar.morestuff.MoreFoo
	   at... [many lines of stacktrace]

Now "foobar.jar" containing the offending class(es) /is/ defined as part 
of the "build.classpath" (and verified, since the javac task in other 
targets is quite happy finding stuff in that library using the same 
build.classpath.)

If I copy (or link, tried both) "foobar.jar" into ${ant.home}/lib, I get 
a /different/ error:

	java.lang.reflect.InvocationTargetException
	    ...
	    Caused by: java.lang.VerifyError: (class: 
org/foobar/metadata/MetaDataElement, method: mergeElement signature: 
(Lorg/foobar/metadata/MetaDataElement;)V)
	    Incompatible object argument for function call

In the docs I see that since ant 1.5 one can define a loaderRef for a 
task, and this looks to me a lot like different classes being defined as 
different because they are being loaded by different classloaders.

Could some kind soul please point me at where to find out more about how 
to use the loaderRef to ensure that all classes are being loaded by the 
same classloader, or some other way to resolve/workaround this issue.

I am also told that the task works under ant 1.3, but have put in so 
much work on refactoring build scripts that I am loath to go backwards 
at this stage...

I am using Ant version 1.5, SunJDK build 1.4.1-b21 on Linux 
(2.4.something if that matters).

--
mike morris
cOcO software - "because you can't reboot the internet"

email: mike.morris (at) coco-technologies . co . za
ph:    (Local) 044 388 4635
        (Int'l) +27 44 388 4635

------- A day without chillies is a day wasted -------




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


Mime
View raw message