I have deployed one web-application, which contains following code.
System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);
Now, I deployed another web-application which also have same code. When it tries to load library, it throwing following error.
Exception in thread "Thread-143" java.lang.UnsatisfiedLinkError:
Native Library /usr/lib/jni/libopencv_java248.so already loaded in
another classloader
I want to run these both application simultaneously.
Till now what I have tried:
- Loaded library in one application and caught above exception into another application
- Removed jars from both application and put opencv.jar into Tomcat's classpath(ie in /usr/share/tomcat7/lib).
But none of above worked, any suggestions by which I can do this ?
Edit: for option two,
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
This line works but gets exception when I am actually going to use that library. That is when I do following
Mat mat = Highgui.imread("/tmp/abc.png");
And I get this exception
java.lang.UnsatisfiedLinkError: org.opencv.highgui.Highgui.imread_1(Ljava/lang/String;)J
at org.opencv.highgui.Highgui.imread_1(Native Method)
at org.opencv.highgui.Highgui.imread(Highgui.java:362)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…