How to use opencv in Java Web application ? [closed]

asked 2017-05-10 01:04:32 -0600


I am trying to use opencv in one of my java web application but i am facing issue related to .so file the native library. i have set java.library.path to path to directory which contains all the required lib for opencv. I am using the sift detection feature of opencv, but when i am running my tomcat which is outside of eclipse means the standalone tomcat on server i get the following error

HTTP Status 500 - Handler processing failed; nested exception is java.lang.UnsatisfiedLinkError: org.opencv.highgui.Highgui.imread_0(Ljava/lang/String;I)J

on the line that Highgui.imread(bookObject, Highgui.CV_LOAD_IMAGE_COLOR);

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-09-26 13:59:52.323282


it did not find the (the jar file only contains wrappers for the native c++ code in the .so)

or maybe you forgot the System.loadLibrary() call, or put it into the wrong class ? (the so has to get loaded, before any other opencv related things can happen)

berak gravatar imageberak ( 2017-05-10 01:11:22 -0600 )edit

hello berak, i have added the call to System.loadLibrary(Core.NATIVE_LIBRARY_NAME); and put it in same class that uses the opencv functions. Can to tell i am wrong we need to place this so file in web-inf lib folder ? i have the same few other things as using java.library.path to so file but still nothing works. i even provided the absolute path using System.load(path); but the same error.

jigar.shah gravatar imagejigar.shah ( 2017-05-10 01:19:20 -0600 )edit

ok, seems all right, so far (we can rule out the usual suspects)

unfortunately, can't help with tomcat (never used it)

berak gravatar imageberak ( 2017-05-10 01:23:17 -0600 )edit

ok thanks berak for your time and looking into it :-)

jigar.shah gravatar imagejigar.shah ( 2017-05-10 01:32:22 -0600 )edit