Greetings,
I had assembled ffmpeg-java (which uses JNA) functions into
webservice (.war, stateless) deployed into Glassfish v2.1 on Linux
(64bit),
it works fine until I modify the code and redeploy it (through
Netbeans 6.5) , then it stops working until I restart/reload whole
Glassfish :-( .
I get exception that some JNI library is already loaded in another
classloader, but
I beleive that when I redeploy webservice into glassfish, the old
classloader is gone, so how can I get through ?
I don't unfortunately don't know much about Classloaders andor JNA/JNI ...
Thanks in advance for any information or pointer towards right place
to find a solution :-)
exception stack trace part (from glassfish domain server.log) :
[#|2009-06-12T21:29:43.084+0200|SEVERE|sun-appserver2.1|com.sun.xml.ws.server.sei.EndpointMethodHandler|_ThreadID=19;
_ThreadName=httpSSLWorkerThread-8080-4;_RequestID=3aa94d48-c8fd-4402-867b-bc328c459396;|
Native Library
/opt/glassfish/domains/domain1/generated/jsp/j2ee-modules/ffmpegapi/loader/com/sun/jna/linux-amd64/libjnidispatch.so
already loaded in another classloader
java.lang.UnsatisfiedLinkError: Native Library
/opt/glassfish/domains/domain1/generated/jsp/j2ee-modules/ffmpegapi/loader/com/sun/jna/linux-amd64/libjnidispatch.so
already loaded in another classloader
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1716)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1005)
at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:633)
at com.sun.jna.Native.loadNativeLibrary(Native.java:574)
at com.sun.jna.Native.<clinit>(Native.java:104)
at net.sf.ffmpeg_java.AVFormatLibrary.<clinit>(AVFormatLibrary.java:18)
at gnvn.earth.avclink.wsl.ffmpeg.FFmpegFile.<init>(FFmpegFile.java:39)
<<-- webservice code
the FFmpegFile.java:39 line :
final AVFormatLibrary AVFORMAT = AVFormatLibrary.INSTANCE;
which goes down to this code :
public interface AVFormatLibrary extends FFMPEGLibrary
{
public static final AVFormatLibrary INSTANCE = (AVFormatLibrary)
Native.loadLibrary(
System.getProperty("os.name").startsWith("Windows") ?
"avformat-51" : "avformat",
AVFormatLibrary.class);
....
}