Re: ERROR : datastax.driver.core.Native:113 - Could not load JNR C Library, native system calls through this library will not be available

4,321 views
Skip to first unread message

Jeremy Chapman

unread,
Aug 29, 2017, 3:55:19 PM8/29/17
to java-dri...@lists.datastax.com
Take a look at this discussion: https://groups.google.com/a/lists.datastax.com/forum/#!topic/java-driver-user/ONpgXJyqTu0

In general an UnsatisfiedLinkError often means your app is using an optional dependency of a jar and you just need to either explicitly include the optional dependency or stop using that feature. For example if you opt to configure LZ4 compression to a cluster with cassandra-driver-core you have to add an explicit dependency to 'net.jpountz.lz4:lz4'.

For this FFI case you might be running on an OS that doesn't support FFI and need to install a package for it. Alternatively you could explicitly exclude FFI dependencies to force DataStax to use its pure-Java implementation. I'd also check to see if a more recent DataStax update does a more graceful automatic fallback to pure-Java with a simple log message instead of a stacktrace; if they haven't already done so you should submit a ticket requesting it.

On Mon, Aug 28, 2017 at 10:56 PM, Ranjan Kumar <hereis...@gmail.com> wrote:
I am getting this error on server. Any idea?

atastax.driver.core.Native:113 - Could not load JNR C Library, native system calls through this library will not be available
java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
        at jnr.ffi.provider.InvalidProvider$1.loadLibrary(InvalidProvider.java:48)
        at jnr.ffi.LibraryLoader.load(LibraryLoader.java:290)
        at jnr.ffi.LibraryLoader.load(LibraryLoader.java:269)
        at com.datastax.driver.core.Native$LibCLoader.<clinit>(Native.java:108)
        at com.datastax.driver.core.Native.isGettimeofdayAvailable(Native.java:190)
        at com.datastax.driver.core.ClockFactory.newInstance(Clock.java:51)
        at com.datastax.driver.core.AbstractMonotonicTimestampGenerator.<init>(AbstractMonotonicTimestampGenerator.java:43)
        at com.datastax.driver.core.LoggingMonotonicTimestampGenerator.<init>(LoggingMonotonicTimestampGenerator.java:49)
        at com.datastax.driver.core.AtomicMonotonicTimestampGenerator.<init>(AtomicMonotonicTimestampGenerator.java:50)
        at com.datastax.driver.core.AtomicMonotonicTimestampGenerator.<init>(AtomicMonotonicTimestampGenerator.java:37)
        at com.datastax.driver.core.policies.Policies.defaultTimestampGenerator(Policies.java:121)
        at com.datastax.driver.core.policies.Policies$Builder.build(Policies.java:286)
        at com.datastax.driver.core.Cluster$Builder.getConfiguration(Cluster.java:1317)
        at com.datastax.driver.core.Cluster.<init>(Cluster.java:113)
        at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:178)
        at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:1335)
Caused by: java.lang.ExceptionInInitializerError
        at jnr.ffi.provider.jffi.NativeRuntime.getInstance(NativeRuntime.java:49)
        at jnr.ffi.provider.jffi.Provider.<init>(Provider.java:29)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at jnr.ffi.provider.FFIProvider$SystemProviderSingletonHolder.getInstance(FFIProvider.java:68)
        at jnr.ffi.provider.FFIProvider$SystemProviderSingletonHolder.<clinit>(FFIProvider.java:57)
        at jnr.ffi.provider.FFIProvider.getSystemProvider(FFIProvider.java:35)
        at jnr.ffi.LibraryLoader.create(LibraryLoader.java:73)
Caused by: java.lang.IllegalStateException: Can't overwrite cause with java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: could not locate stub library in jar file.  Tried [jni/x86_64-Linux/libjffi-1.2.so, /jni/x86_64-Linux/libjffi-1.2.so]
        at com.kenai.jffi.internal.StubLoader.getStubLibraryStream(StubLoader.java:396)
        at com.kenai.jffi.internal.StubLoader.loadFromJar(StubLoader.java:345)
        at com.kenai.jffi.internal.StubLoader.load(StubLoader.java:254)
        at com.kenai.jffi.internal.StubLoader.<clinit>(StubLoader.java:434)
    at com.datastax.driver.core.Native.isGettimeofdayAvailable(Native.java:190)
    at com.datastax.driver.core.ClockFactory.newInstance(Clock.java:51)
        at com.datastax.driver.core.AbstractMonotonicTimestampGenerator.<init>(AbstractMonotonicTimestampGenerator.java:43)
        at com.datastax.driver.core.LoggingMonotonicTimestampGenerator.<init>(LoggingMonotonicTimestampGenerator.java:49)
        at com.datastax.driver.core.AtomicMonotonicTimestampGenerator.<init>(AtomicMonotonicTimestampGenerator.java:50)
        at com.datastax.driver.core.AtomicMonotonicTimestampGenerator.<init>(AtomicMonotonicTimestampGenerator.java:37)
        at com.datastax.driver.core.policies.Policies.defaultTimestampGenerator(Policies.java:121)
        at com.datastax.driver.core.policies.Policies$Builder.build(Policies.java:286)
        at com.datastax.driver.core.Cluster$Builder.getConfiguration(Cluster.java:1317)
        at com.datastax.driver.core.Cluster.<init>(Cluster.java:113)
        at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:178)
        at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:1335)

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-user+unsubscribe@lists.datastax.com.

Ranjan Kumar

unread,
Sep 4, 2017, 11:27:06 PM9/4/17
to DataStax Java Driver for Apache Cassandra User Mailing List
Resolved by passing -Dcom.datastax.driver.USE_NATIVE_CLOCK=false  to JVM argument on app start up.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

Reply all
Reply to author
Forward
0 new messages