我尝试将OpenCV安装为JBoss-as实例的全局模块.版本是:
我从全新安装的Ubuntu Server 12.04 64位开始,只安装了JBoss-as和OpenCV.
OpenCV java包装器使用JNI调用.因此需要两件事:
可用/usr/share/OpenCV/java/(关于安装)
我还指出了一些意见:
opencv-245.jar作为依赖项pom.xml,因此被打包到其中war)一旦我将OpenCV定义为JBoss全局模块(<scope>provided</scope>在pom.xml中设置),就会引发此异常:
java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat()J
org.opencv.core.Mat.n_Mat(Native Method)
org.opencv.core.Mat.<init>(Mat.java:441)
WS.printMessage(WS.java:15)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
Run Code Online (Sandbox Code Playgroud)
似乎jar找到了OpenCV 库,因为它引发了异常.此外,它没有抱怨一些未找到的库(从最后的第一个链接获取):
java.lang.UnsatisfiedLinkError: no xxxx in java.library.path
Run Code Online (Sandbox Code Playgroud)
因此我猜这libopencv_java245.so不是问题.精确配置如下所述.
我org.opencv在modules/org/opencv/main/module.xml以下位置定义了模块:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.opencv">
<resources>
<resource-root path="opencv-245.jar"/> …Run Code Online (Sandbox Code Playgroud)