UnsatisfiedLinkError upon sevenzipbinding initialization
Java wrapper for 7z archiver engine
Brought to you by:
boris_brodski
Hi,
I am using sevenzipjbinding-AllPlatforms-4.65-1.06-rc.jar on Ubuntu 12.04 from java application.
It was stable for long time but suddenly i received the following error:
java.lang.UnsatisfiedLinkError: /data/manager/tmp/SevenZipJBinding-bqNzq/lib7-Zip-JBinding.so: /data/manager/tmp/SevenZipJBinding-bqNzq/lib7-Zip-JBinding.so: failed to map segment from shared object: Operation not permitted at java.lang.ClassLoader$NativeLibrary.load(Native Method) ~[na:1.8.0_91] at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) ~[na:1.8.0_91] at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824) ~[na:1.8.0_91] at java.lang.Runtime.load0(Runtime.java:809) ~[na:1.8.0_91] at java.lang.System.load(System.java:1086) ~[na:1.8.0_91] at net.sf.sevenzipjbinding.SevenZip.loadNativeLibraries(SevenZip.java:509) ~[sevenzipjbinding-4.65-1.06-rc.jar:na] ... 49 common frames omitted Wrapped by: net.sf.sevenzipjbinding.SevenZipNativeInitializationException: 7-Zip-JBinding initialization failed: Error loading native library: '/data/manager/tmp/SevenZipJBinding-bqNzq/lib7-Zip-JBinding.so'
After that 7zip just refused to be initialized no matter what i tried. The only solution that worked for me was to reinstall the application which redeployed the 7zip files.
I looked at the permissins of /data/manager/tmp and it have rwx permissions as it supposed to be.
I dont have any clue in our logs why this happened.
Thanks a lot in advance,
Dani Gelmanovich
Hello Dani,
this is very strange bug. You need "x" permission on the files in the tmp directory. If you mount your tmp directory you may try
sudo mount /tmp -o remount,exec
If you are using 7-Zip-JBinding within your project, that you install on the system, you may change the installer to create your own tmp-directory and then initialize 7-Zip-JBinding passing this directory as a tmp directory to use:
The installer may also check the new tmp directory for the required permissions and enough space beforehand.
I hope, it helps.
Cheers,
Boris
Hi,
I think i got it:
/data/manager/tmp was my temp folder for sevenzip and it had indeed rwx permissions.
The issue is that the partition of /data is set with "noexec" flag. I thing that this might be the root cause.
Maybe its a good chance to add guidelines in the documentation indicating that the partition of the tmp folder must not have "noexec" flag