java.lang.UnsatisfiedLinkError: no GurobiJni / Tomcat

一笑奈何 提交于 2019-12-02 05:14:34

Any idea to solve the problem?

You can set LD_LIBRARY_PATH to point to the directory of Gurobi where the .so files are stored, and also the directory where the .jar files are stored.

You can also make Gurobi jar file accessible from Tomcat by copying or linking it.

ln -sv $GUROBI_HOME/lib/gurobi.jar $TOMCAT_HOME/lib/

Edit 1

try

declare -x LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"

instead of

declare -x LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:\${GUROBI_HOME}/lib"

There is a mistake by using \ , and you didn't copy/paste the official doc.

For further debugging, create a JSP with this content, it displays all System properties and we'll see java.library.path. It's weird nobody ever posted this before.

<%@ page import="java.util.Properties" %>
<%@ page import="java.util.Set" %>

<%
Properties p = System.getProperties();

Set<String> keys = p.stringPropertyNames();
for (String key : keys)
  out.println(key + " : " + p.getProperty(key));

%>

Edit 2

From your debug JSP we see that ld.library.path is correctly pointing to your GUROBI lib directory. We can try adding a System Property for java.library.path. In your Tomcat installation, edit or create bin/setenv.sh file with this content :

CATALINA_OPTS="-Djava.library.path=/opt/gurobi752/linux64/lib/"

An explanation to this suggestion can be read here.

btw I don't know where you put your declare -x , but it would be legitimate to store them in bin/setenv.sh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!