Hello gurobi folks!
I'm trying to integrate Gurobi with our internal web application that's built using Grails (JVM-based web framework), gets packaged into war file aand is running on tomcat. So, I'm using Gurobi Java API.
The issue I'm running into is whenever I try to create Gubori object I get an Exception as follows:
java.lang.UnsatisfiedLinkError: no GurobiJni60 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1878)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1087)
at gurobi.GurobiJni.<clinit>(GurobiJni.java:197)
at gurobi.GRBEnv.<init>(GRBEnv.java:16)
I understand somehow tomcat fails to find GurobiJni60 library, but I'm puzzled, because I'm pretty sure the library is there and I specified all the necessary configurations.
The gurobi is installed on the server and I can successfully run java examples from the command line like so:
cd gurobi600/linux64/examples/build/
make run_java
I've set the gurobi variables in the tomcat7/conf/tomcat7.conf file:
export GUROBI_HOME="/home/ec2-user/gurobi600/linux64/"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
export GRB_LICENSE_FILE="/home/ec2-user/gurobi.lic"
I've also specified java.library.path variable like so:
-Djava.library.path=/home/ec2-user/gurobi600/linux64/lib
Alternatively I tried placing symlinks pointing to the libGurobiJni60.so file into tomcat's lib folder:
tomcat7/lib. I've also tried placing same symlinks into tomcat7/shared/lib and changed tomcat7/conf/catalina.properties to pick up files under share/lib.
But I'm still getting same error.
I even tried loading libGurobiJni60.so library explicitly like so:
path = "/home/ec2-user/gurobi600/linux64/lib/libGurobiJni60.so"
Runtime.getRuntime().load0(groovy.lang.GroovyClassLoader.class, path)
but it fails with another exception:
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /home/ec2-user/gurobi600/linux64/lib/libGurobiJni60.so
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1846)
at java.lang.Runtime.load0(Runtime.java:795)
at Script1.run(Script1.groovy:6)
Any pointers or help would be greatly appreciated.
Warm regards,
Zhanibek