fdb-java on macOS catalina throwing error "Library not loaded: libfdb_c.dylib" with azul open jdk
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 1.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 126
Description
Filing the below issue after discussing the topic in the [forum](https://forums.foundationdb.org/t/fdb-java-on-macos-catalina-throwing-error-library-not-loaded-libfdb-c-dylib/1894).
`fdb-java` on macOS catalina is throwing the below error when used with Azul open jdk 8
```
java.lang.UnsatisfiedLinkError: /private/var/folders/m3/dhywtct96_q596wpwhjjlmfh0000gq/T/fdbjni3136449478736359170.library: dlopen(/private/var/folders/m3/dhywtct96_q596wpwhjjlmfh0000gq/T/fdbjni3136449478736359170.library, 1): Library not loaded: libfdb_c.dylib
Referenced from: /private/var/folders/m3/dhywtct96_q596wpwhjjlmfh0000gq/T/fdbjni3136449478736359170.library
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
at java.lang.Runtime.load0(Runtime.java:810)
at java.lang.System.load(System.java:1086)
at com.apple.foundationdb.JNIUtil.loadLibrary(JNIUtil.java:106)
at com.apple.foundationdb.FDB.(FDB.java:97)
at com.vnera.storage.config.fdb.common.FDB.(FDB.java:135)
at com.vnera.storage.config.fdb.common.FDB.get(FDB.java:242)
at com.vnera.storage.config.fdb.FdbTestStorageUtils.setUp(FdbTestStorageUtils.java:61)
at com.vnera.storage.config.fdb.FdbTestStorageUtils.setUp(FdbTestStorageUtils.java:33)
at com.vnera.tools.FdbEventMigrationTest.setupTest(FdbEventMigrationTest.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)
```
Java Version
```
dmanna-a01:~ dmanna$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (Zulu 8.44.0.10-SA-macosx) (build 1.8.0_242-b20)
OpenJDK 64-Bit Server VM (Zulu 8.44.0.10-SA-macosx) (build 25.242-b20, mixed mode
```
The issue does not come with Oracle JDK 8.
Other Environment Details
- OS Version - Mac OS Catalina - 10.15.2
- Foundation Client and Server - 6.2.10
- fdb-java - 6.1.9
The main problem seems to be that the fdb binaries are not notarised / signed as per Apple’s requirements.
Azul JDK notarises the distribution with a more recent secure certificate, however, AdoptOpenJDK and Oracle use older certificates. Thus the Zulu distributions are stricter and does not allow unsigned JNI applications to load libraries from unsecured locations on Catalina.
It seems the pass given to Oracle and AdoptOpenJDK will stop soon, will be forced to update the certificates and will behave similar to Zulu. See [this](https://appleinsider.com/articles/19/12/23/apple-will-enforce-app-notarization-for-macos-catalina-in-february).
Azul has published the following tech doc for this
https://support.azul.com/hc/en-us/articles/360039650212-On-MacOS-10-15-3-and-later-Zulu-Java-doesn-t-load-the-JNI-Libraries-my-Application-needs
Contributor guide
Assessment
This issue has not been assessed yet.