我一直在尝试在tomcat上部署一个JavaCV应用程序,但我没有成功,它在第一次运行后返回我的UnsatisfiedLinkError。
javax.servlet.ServletException: Servlet.init() for servlet servlets.ImageRecognize threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
root cause
java.lang.UnsatisfiedLinkError: Native Library D:\javacv-bin\windows-x86_64\jniopencv_core.dll already loaded in another classloader
java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1905)
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
java.lang.Runtime.loadLibrary0(Runtime.java:845)
java.lang.System.loadLibrary(System.java:1084)
com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
com.googlecode.javacpp.Loader.load(Loader.java:489)
com.googlecode.javacpp.Loader.load(Loader.java:431)
com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:136)
答案 0 :(得分:0)
当我发现你遇到同样的问题时,我正在寻找一个永久的解决方案。
对此的临时修复是每次进行更改时重新启动Apache Server(而不仅仅是让模块上下文自动重新加载)。
答案 1 :(得分:0)
我认为您两次加载了openCV依赖项。加载一次。