Even though the same class can be loaded several times in the same JVM 
through mutliple classloaders, the same does not work for native code -- 
all native libs can be loaded only once per JVM instance.

The only way for you to work around this known issue is to redesign your 
test suite such that the native lib is loaded only by a facade class of 
some kind that is placed in a classloader that is the common parent to all 
classloaders that JUnit might be using. Placing it in ANT's  -classpath or 
making it accessible to AntClassLoader might work. If you can't do that, 
you are out of luck.

[I would provide more pointed advice except I am not using JUnit myself -- 
using a better framework at work].
Vlad.



Please respond to "Ant Users List" <[EMAIL PROTECTED]>
To:     [EMAIL PROTECTED]
cc: 

Subject:        Ant, Junit and native llibrary


Hi,

I have a problem when using the optional JUnit task when testing classes
that use native code.

The first test case of the batch would run fine but any subsequent test 
case
that use the same native library would throw an UnsatisfiedLinkError. Per
the error message, I suspect a classloading problem but was not ablt to
figure out a workaround.
I tried forking but had problems with the classpath. The tests would
ultimatly run but would not produce any results.

Can someone help? Thanks in advance.

Bao-Long

------

Ant version: 1.4.1

Error message:
UnsatisfiedLinkError loading library: <lib name> Library <lib location>
already loaded in another classloader





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to