java - Tomcat 7 + JNI: UnsatisfiedLinkError: cannot open shared object file: No such file or directory -
here's problem: have war file contains webapp, , .jar in web-inf/lib depends on .so files present on host tomcat running. when deploy war file through app manager, unsatisfiedlinkerror: file not found
in startup logs when jni wrapper class loaded .jar. when in directory linked libraries are, present, , have world read , execute permissions, , i've changed owner same run-as user executing tomcat. permissions problem, because can execute war file on command line, , not error. i'm hoping can spot have missed, or direct me tomcat documentation i've misread.
here's full text of error when deployed via tomcat manager:
07 apr 2017 10:45:53,140 [error] [... omitted irrelevant log output ...] java.lang.unsatisfiedlinkerror: /opt/omitted-sdk-name/linux_x86_64/bin/libjni_emdq.so: libemdq.so: cannot open shared object file: no such file or directory
if shut down tomcat via systemctl stop tomcat
, execute war file (as root), not unsatisfiedlinkerror
:
java -djava.library.path=/opt/omitted-sdk-name/linux_x86_64/bin -jar /path/to/my/app##0.1.war
some other useful info:
- centos 7
- fresh, vanilla install via yum (no deviations default config, except enable admin user on manager , switch default jvm).
/usr/sbin/tomcat version
shows:
server version: apache tomcat/7.0.69 server built: nov 6 2016 01:55:51 utc server number: 7.0.69.0 os name: linux os version: 3.10.0-514.10.2.el7.x86_64 architecture: amd64 jvm version: 1.8.0_121-b13 jvm vendor: oracle corporation
- tomcat running user
tomcat
- i've tried changing ownership
root
tomcat
of .so files in sdk. changing owners did not change actual behavior. example, owner/mode yields problem - same owner tomcat run-as user, , full read+executable permission, expected have fixed things:
[root@omitted-host bin]# ls -la | grep emdq -rwxr-xr-x 1 tomcat tomcat 403153 nov 10 03:10 libemdq.so -rwxr-xr-x 1 tomcat tomcat 76850 nov 10 03:11 libjni_emdq.so
- edit: there seems 2 versions of java on machine. 1 in
root
's path 1.8.0_77 , 1 configured tomcat 1.8.0_121:
[root@omitted-host tomcat]# java -version java version "1.8.0_77" java(tm) se runtime environment (build 1.8.0_77-b03) java hotspot(tm) 64-bit server vm (build 25.77-b03, mixed mode) [root@omitted-host tomcat]# /etc/alternatives/jre_1.8.0_openjdk/bin/java -version openjdk version "1.8.0_121" openjdk runtime environment (build 1.8.0_121-b13) openjdk 64-bit server vm (build 25.121-b13, mixed mode)
- output of
file
on 2 .so in question shows 64-bit libs, don't think there's problem running in 64-bit jvm:
[root@omitted-host bin]# file libjni_emdq.so libjni_emdq.so: elf 64-bit lsb shared object, x86-64, version 1 (sysv), dynamically linked, not stripped [root@omitted-host bin]# file libemdq.so libemdq.so: elf 64-bit lsb shared object, x86-64, version 1 (sysv), dynamically linked, not stripped
- i have these lines in file in
$catalina_home/conf/conf.d/omittedname.conf
. @ point in past, had them in tomcat.conf either location seems yield same results.
my_bin="/opt/omitted-sdk-name/linux_x86_64/bin" ld_library_path="$ld_library_path:$my_bin" java_opts="$java_opts -djava.library.path=$my_bin -djava.security.egd=file:/dev/./urandom -djava.awt.headless=true -xx:+useconcmarksweepgc" # needed run application java_opts="$java_opts -dprofile=test"
- edit: after posting this, noticed
root
has different jvm in path. java version above edited too.
[root@omitted-host tomcat]# echo $path /java/jdk1.8.0_77/bin:/opt/omitted-sdk-name/linux_x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
is there else can try looking at? possibly need add java.io.filepermissions permission?
also, humble statement aware of implications of running/owning things root. goal working tomcat manager configuration un-break development server.
this answer less satisfying, key solving problem. had move statement ld_library_path=/opt/omitted-sdk-name/linux_x86_64/bin
$catalina_home/conf/conf.d/myapp.conf
$catalina_home/conf/tomcat.conf
. after did this, unsatisfiedlinkerror
disappeared.
Comments
Post a Comment