Running the FDB client on AWS Lambda

I’m trying to get the FDB client (for Java) to work on AWS Lambda using their new Layers option. Right now I am putting fdb.cluster in the root and libfdb_c.so in the lib directory. I think it is now finding the library but it is having trouble initializing the FDB class. Has anyone gotten this to work? What else might I need?

Update. Looking more closely it is first failing to load the library. Not sure why it isn’t finding it.

/tmp/fdbjni5638734001205186806.library: libfdb_c.so: cannot open shared object file: No such file or directory: java.lang.UnsatisfiedLinkError
java.lang.UnsatisfiedLinkError: /tmp/fdbjni5638734001205186806.library: libfdb_c.so: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.apple.foundationdb.JNIUtil.loadLibrary(JNIUtil.java:106)
at com.apple.foundationdb.FDB.<clinit>(FDB.java:97)
at com.observeinc.Loader.handleRequest(Loader.java:179)
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)

I’m constructing the layer as:

$ zip -u fdb_layer.zip fdb.cluster lib/libfdb_c.so
zip warning: fdb_layer.zip not found or empty
adding: fdb.cluster (stored 0%)
adding: lib/libfdb_c.so (deflated 62%)

Solved. Due to the way they lay out the layers you need to set LD_LIBRARY_PATH="/opt" and FDB_CLUSTER_FILE="/opt/fdb.cluster".

1 Like