]
Tomasz Adamski reassigned WFLY-9881:
------------------------------------
Assignee: Tomasz Adamski (was: Jason Greene)
UnsatisfiedLinkError - Open CV
--------------------------------
Key: WFLY-9881
URL:
https://issues.jboss.org/browse/WFLY-9881
Project: WildFly
Issue Type: Bug
Components: EJB
Affects Versions: 11.0.0.Final
Environment: Windows Server 2012 R2 \ Windows 8.1 Professional, 64 bit JRE\JDK 8
update 112
OpenCV 3.3.0 (
https://github.com/opencv/opencv/releases/tag/3.3.0)
Reporter: Richard Cannock
Assignee: Tomasz Adamski
Priority: Major
Deploying a simple Stateless session bean with a single get method that has a dependency
on OpenCV release 3.3.0 (opencv-330.jar) and it's corresponding 64 bit native library
(opencv_java330.dll) from
https://github.com/opencv/opencv/releases/tag/3.3.0
results in a UnsatisfiedLinkError:
Caused by: java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_eye(III)J
at org.opencv.core.Mat.n_eye(Native Method)
at org.opencv.core.Mat.eye(Mat.java:492)
at test.SimpleJMSRestfulWebService.putMessage(SimpleJMSRestfulWebService.java:57)
The sample get method is shown below:
package test;
import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
/**
*
*/
@Stateless
@Path("/jms")
public class SimpleJMSRestfulWebService
{
/**
* Our RESTful webservice
*/
@GET
public String putMessage()
{
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat mat = Mat.eye(3, 3, CvType.CV_8UC1);
System.out.println("mat = " + mat.dump());
return "works";
}
}
The native library is placed in C:\Windows, which is in the java.library.path system
variable.
Same code runs without exception in GlassFish Server 4.1 and also within netbeans 8.2
(albeit in a differnet test harness)
Using -Djava.library.path VM argumnents using a different path for the native library
also causes the same error.in wildfly.
Removing the library from C:\Windows causes a different stack trace, which suggests that
wildfly is at least partially loading the library:
Caused by: java.lang.UnsatisfiedLinkError: no opencv_java330 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
Using depends.exe or dependency walker on opencv_java330.dll reports no unsatisfied
dependencies for this dll.