Question

Error loading a Java native library (.so) in Apache Tomcat 7 in a CentOS7 DigitalOcean server

I am new to DigitalOcean, Linux and libraries, and deeply appreciate any help from you on the following issue: I have been trying to make a native library work (libjsmile.so) in a web application with Apache Tomcat 7 on a Linux CentOS 7 DigitalOcean server, but I still haven’t succeeded. I was able to use this wrapper library (libjsmile.jnilib) as a Java application or a web application with Apache Tomcat 7 on a Mac. And I was able to load libjsmile.so as a Java application on this CentOS 7 server. The error starts to occur when I want to load libjsmile.so in a web application with Apache Tomcat 7 in this CentOS 7 server. I have tried to add LD_LIBRARY_PATH=“/usr/share/java/tomcat” and/or JAVA_OPTS=“-Djava.library.path=/usr/share/java/tomcat” to the Tomcat configuration file (tomcat.conf) and put the libjsmile.so inside that path. I have also tried to use System.loadLibrary(“jsmile”); or System.load(“/usr/share/java/tomcat/libjsmile.so”); Although some of the above methods could work in a Java application on the CentOS7 server, none of them work when I change to a web application using apache tomcat 7 on the CentOS7 server. It either gives the following error: java.lang.UnsatisfiedLinkError: smile.Wrapper.nativeStaticInit() Or just hang there (keep waiting for a response). Thanks a lot for any of your suggestions!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer