Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenCV as JBoss-as global module
    primarykey
    data
    text
    <h1>Problem presentation</h1> <p>I try to install OpenCV as global module of a JBoss-as instance. The versions are:</p> <ul> <li>JBoss-as: 7.1.1 Final</li> <li>OpenCV: 2.4.5 (compiled with Java support)</li> </ul> <p>I started from a fresh installation of Ubuntu Server 12.04 64 bits with only JBoss-as and OpenCV installed.</p> <h1>Preamble</h1> <p>The OpenCV java wrapper use JNI calls. Thus two things are required:</p> <ul> <li>opencv-245.jar</li> <li>libopencv_java245.so</li> </ul> <p>And available in <code>/usr/share/OpenCV/java/</code> (regarding to installation)</p> <p>I also point some observations:</p> <ol> <li>The installation of JBoss is correct (applications can be deployed and are working)</li> <li>The compilation and installation of OpenCV with java support is correct (Java class using OpenCV are working) </li> <li>A basic web application using OpenCV and deployed, with maven, on JBoss-as works (the <code>opencv-245.jar</code> is listed as dependency in <code>pom.xml</code>, and thus packaged into the <code>war</code>)</li> </ol> <h1>Problem description</h1> <p>As soon as I define OpenCV as JBoss global module (setting <code>&lt;scope&gt;provided&lt;/scope&gt;</code> in pom.xml) this exception is raised:</p> <pre class="lang-java prettyprint-override"><code>java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat()J org.opencv.core.Mat.n_Mat(Native Method) org.opencv.core.Mat.&lt;init&gt;(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) </code></pre> <p>It appears that the OpenCV <code>jar</code> library is found because the exception is raised from it. Also it does not complains about some library not found like (taken from first link at the end):</p> <pre class="lang-java prettyprint-override"><code>java.lang.UnsatisfiedLinkError: no xxxx in java.library.path </code></pre> <p>thus I guess the <code>libopencv_java245.so</code> is not the problem. The precise configuration is described below.</p> <h1>Configurations</h1> <p>I defined the <code>org.opencv</code> module in <code>modules/org/opencv/main/module.xml</code>:</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;module xmlns="urn:jboss:module:1.0" name="org.opencv"&gt; &lt;resources&gt; &lt;resource-root path="opencv-245.jar"/&gt; &lt;/resources&gt; &lt;dependencies&gt; &lt;module name="javax.api"/&gt; &lt;/dependencies&gt; &lt;/module&gt; </code></pre> <p>Then I put in the same folder <code>opencv-245.jar</code> and also <code>libopencv_java245.so</code> in <code>lib/linux-x86_64/</code> subfolder (as explained in <a href="https://docs.jboss.org/author/display/MODULES/Native+Libraries" rel="nofollow noreferrer">Native Library</a>)</p> <p>To define this module as global I modified in <code>standalone/configuration/standalone.xml</code>:</p> <pre class="lang-xml prettyprint-override"><code>&lt;subsystem xmlns="urn:jboss:domain:ee:1.0"&gt; &lt;global-modules&gt; &lt;module name="org.opencv" slot="main"/&gt; &lt;/global-modules&gt; &lt;/subsystem&gt; </code></pre> <p>Finally to use the global module I set in <code>src/main/webapp/WEB-INF/jboss-deployment-structure.xml</code>:</p> <pre class="lang-xml prettyprint-override"><code>&lt;jboss-deployment-structure&gt; &lt;deployment&gt; &lt;dependencies&gt; &lt;module name="org.opencv" /&gt; &lt;/dependencies&gt; &lt;/deployment&gt; &lt;/jboss-deployment-structure&gt; </code></pre> <p>I also reminds that I have put <code>&lt;scope&gt;provided&lt;/scope&gt;</code> in my maven <code>pom.xml</code>.</p> <p>Also, putting:</p> <pre class="lang-java prettyprint-override"><code>System.loadLibrary("opencv_java245"); </code></pre> <p>or not in the code doesn't change anything.</p> <h1>Extra observations</h1> <p>I also noticed that with an <code>ear</code> application, composed of one <code>war</code> and one <code>jar</code>, even the procedure described in point 3 in "Preamble" does not work and give the same exception as above. Maybe this information can help.</p> <p>Someone have some pointers or solutions?</p> <h1>Related questions</h1> <ul> <li><a href="https://stackoverflow.com/questions/12775827/path-setting-for-dlls-in-jboss-7-1-1">Path setting for DLL&#39;s in JBOSS 7.1.1</a></li> <li><a href="https://stackoverflow.com/questions/12896950/jboss-7-is-trying-to-load-modules-libraries-from-jboss-bin">JBoss 7 is trying to load modules libraries from JBoss bin</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload