You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added java-dogstatsd-client 2.6.1 to my Java 1.8 project using Ivy + Maven and then configured the client to send metrics via Unix socket. The project compiled successfully, however I started getting a bunch of runtime errors related to JFFI. I don't have all the stacktraces unfortunately but there were things like:
LoadError: Could not load FFI Provider: (NotImplementedError) FFI not available: null
Exception in thread "main" java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
at jnr.ffi.provider.InvalidRuntime.newLoadError(InvalidRuntime.java:101)
at jnr.ffi.provider.InvalidRuntime.findType(InvalidRuntime.java:42)
at jnr.ffi.Struct$NumberField.<init>(Struct.java:872)
at jnr.ffi.Struct$Unsigned8.<init>(Struct.java:1113)
at jnr.unixsocket.SockAddrUnix$BSDSockAddrUnix.<init>(SockAddrUnix.java:187)
at jnr.unixsocket.SockAddrUnix.create(SockAddrUnix.java:174)
at jnr.unixsocket.UnixSocketAddress.<init>(UnixSocketAddress.java:53)
at com.timgroup.statsd.NonBlockingStatsDClient$5.call(NonBlockingStatsDClient.java:1073)
at com.timgroup.statsd.NonBlockingStatsDClient$5.call(NonBlockingStatsDClient.java:1070)
at com.timgroup.statsd.NonBlockingStatsDClient.staticAddressResolution(NonBlockingStatsDClient.java:1090)
at com.timgroup.statsd.NonBlockingStatsDClient.staticStatsDAddressResolution(NonBlockingStatsDClient.java:1100)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:283)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:171)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:146)
at com.mortardata.mhc.metrics.StatsD.<init>(StatsD.java:20)
at com.mortardata.mhc.metrics.StatsD.<init>(StatsD.java:9)
at com.mortardata.mhc.metrics.StatsD$SingletonHolder.<clinit>(StatsD.java:28)
at com.mortardata.mhc.metrics.StatsD.getInstance(StatsD.java:32)
at com.mortardata.mhc.Main.main(Main.java:69)
Caused by: java.lang.NoClassDefFoundError: com/kenai/jffi/Type
at jnr.ffi.provider.jffi.NativeRuntime.jafflType(NativeRuntime.java:202)
at jnr.ffi.provider.jffi.NativeRuntime.buildTypeMap(NativeRuntime.java:85)
at jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:66)
at jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:41)
at jnr.ffi.provider.jffi.NativeRuntime$SingletonHolder.<clinit>(NativeRuntime.java:62)
at jnr.ffi.provider.jffi.NativeRuntime.getInstance(NativeRuntime.java:58)
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.Runtime$SingletonHolder.<clinit>(Runtime.java:82)
at jnr.ffi.Runtime.getSystemRuntime(Runtime.java:67)
at jnr.unixsocket.SockAddrUnix.<init>(SockAddrUnix.java:46)
at jnr.unixsocket.SockAddrUnix$BSDSockAddrUnix.<init>(SockAddrUnix.java:185)
... 14 more
Caused by: java.lang.ClassNotFoundException: com.kenai.jffi.Type
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 33 more
Exception in thread "main" java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
at jnr.ffi.provider.InvalidRuntime.newLoadError(InvalidRuntime.java:101)
at jnr.ffi.provider.InvalidRuntime.findType(InvalidRuntime.java:42)
at jnr.ffi.Struct$NumberField.<init>(Struct.java:872)
at jnr.ffi.Struct$Unsigned8.<init>(Struct.java:1113)
at jnr.unixsocket.SockAddrUnix$BSDSockAddrUnix.<init>(SockAddrUnix.java:187)
at jnr.unixsocket.SockAddrUnix.create(SockAddrUnix.java:174)
at jnr.unixsocket.UnixSocketAddress.<init>(UnixSocketAddress.java:53)
at com.timgroup.statsd.NonBlockingStatsDClient$5.call(NonBlockingStatsDClient.java:1073)
at com.timgroup.statsd.NonBlockingStatsDClient$5.call(NonBlockingStatsDClient.java:1070)
at com.timgroup.statsd.NonBlockingStatsDClient.staticAddressResolution(NonBlockingStatsDClient.java:1090)
at com.timgroup.statsd.NonBlockingStatsDClient.staticStatsDAddressResolution(NonBlockingStatsDClient.java:1100)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:283)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:171)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:146)
at com.mortardata.mhc.metrics.StatsD.<init>(StatsD.java:20)
at com.mortardata.mhc.metrics.StatsD.<init>(StatsD.java:9)
at com.mortardata.mhc.metrics.StatsD$SingletonHolder.<clinit>(StatsD.java:28)
at com.mortardata.mhc.metrics.StatsD.getInstance(StatsD.java:32)
at com.mortardata.mhc.Main.main(Main.java:69)
Caused by: java.lang.UnsatisfiedLinkError: could not get native definition for type: POINTER
at com.kenai.jffi.Type$Builtin.lookupTypeInfo(Type.java:251)
at com.kenai.jffi.Type$Builtin.getTypeInfo(Type.java:237)
at com.kenai.jffi.Type.resolveSize(Type.java:155)
at com.kenai.jffi.Type.size(Type.java:138)
at jnr.ffi.provider.jffi.NativeRuntime$TypeDelegate.size(NativeRuntime.java:178)
at jnr.ffi.provider.AbstractRuntime.<init>(AbstractRuntime.java:48)
at jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:57)
at jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:41)
at jnr.ffi.provider.jffi.NativeRuntime$SingletonHolder.<clinit>(NativeRuntime.java:53)
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.Runtime$SingletonHolder.<clinit>(Runtime.java:82)
at jnr.ffi.Runtime.getSystemRuntime(Runtime.java:67)
at jnr.unixsocket.SockAddrUnix.<init>(SockAddrUnix.java:46)
at jnr.unixsocket.SockAddrUnix$BSDSockAddrUnix.<init>(SockAddrUnix.java:185)
... 14 more
Caused by: java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: could not locate stub library in jar file. Tried [jni/Darwin/libjffi-1.2.dylib, /jni/Darwin/libjffi-1.2.dylib]
at com.kenai.jffi.internal.StubLoader.getStubLibraryStream(StubLoader.java:412)
at com.kenai.jffi.internal.StubLoader.loadFromJar(StubLoader.java:355)
at com.kenai.jffi.internal.StubLoader.load(StubLoader.java:258)
at com.kenai.jffi.internal.StubLoader.<clinit>(StubLoader.java:449)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.kenai.jffi.Init.load(Init.java:68)
at com.kenai.jffi.Foreign$InstanceHolder.getInstanceHolder(Foreign.java:49)
at com.kenai.jffi.Foreign$InstanceHolder.<clinit>(Foreign.java:45)
at com.kenai.jffi.Foreign.getInstance(Foreign.java:103)
at com.kenai.jffi.Type$Builtin.lookupTypeInfo(Type.java:242)
at com.kenai.jffi.Type$Builtin.getTypeInfo(Type.java:237)
at com.kenai.jffi.Type.resolveSize(Type.java:155)
at com.kenai.jffi.Type.size(Type.java:138)
at jnr.ffi.provider.jffi.NativeRuntime$TypeDelegate.size(NativeRuntime.java:178)
at jnr.ffi.provider.AbstractRuntime.<init>(AbstractRuntime.java:48)
at jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:57)
at jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:41)
at jnr.ffi.provider.jffi.NativeRuntime$SingletonHolder.<clinit>(NativeRuntime.java:53)
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.Runtime$SingletonHolder.<clinit>(Runtime.java:82)
at jnr.ffi.Runtime.getSystemRuntime(Runtime.java:67)
at jnr.unixsocket.SockAddrUnix.<init>(SockAddrUnix.java:46)
at jnr.unixsocket.SockAddrUnix$BSDSockAddrUnix.<init>(SockAddrUnix.java:185)
at jnr.unixsocket.SockAddrUnix.create(SockAddrUnix.java:174)
at jnr.unixsocket.UnixSocketAddress.<init>(UnixSocketAddress.java:53)
at com.timgroup.statsd.NonBlockingStatsDClient$5.call(NonBlockingStatsDClient.java:1073)
at com.timgroup.statsd.NonBlockingStatsDClient$5.call(NonBlockingStatsDClient.java:1070)
at com.timgroup.statsd.NonBlockingStatsDClient.staticAddressResolution(NonBlockingStatsDClient.java:1090)
at com.timgroup.statsd.NonBlockingStatsDClient.staticStatsDAddressResolution(NonBlockingStatsDClient.java:1100)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:283)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:171)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:146)
at com.mortardata.mhc.metrics.StatsD.<init>(StatsD.java:20)
at com.mortardata.mhc.metrics.StatsD.<init>(StatsD.java:9)
at com.mortardata.mhc.metrics.StatsD$SingletonHolder.<clinit>(StatsD.java:28)
at com.mortardata.mhc.metrics.StatsD.getInstance(StatsD.java:32)
at com.mortardata.mhc.Main.main(Main.java:69)
at com.kenai.jffi.Foreign.newLoadError(Foreign.java:72)
at com.kenai.jffi.Foreign.access$300(Foreign.java:42)
at com.kenai.jffi.Foreign$InValidInstanceHolder.getForeign(Foreign.java:98)
at com.kenai.jffi.Foreign.getInstance(Foreign.java:103)
at com.kenai.jffi.Type$Builtin.lookupTypeInfo(Type.java:242)
... 36 more
Caused by: java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: could not locate stub library in jar file. Tried [jni/Darwin/libjffi-1.2.dylib, /jni/Darwin/libjffi-1.2.dylib]
at com.kenai.jffi.internal.StubLoader.getStubLibraryStream(StubLoader.java:412)
at com.kenai.jffi.internal.StubLoader.loadFromJar(StubLoader.java:355)
at com.kenai.jffi.internal.StubLoader.load(StubLoader.java:258)
at com.kenai.jffi.internal.StubLoader.<clinit>(StubLoader.java:449)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.kenai.jffi.Init.load(Init.java:68)
at com.kenai.jffi.Foreign$InstanceHolder.getInstanceHolder(Foreign.java:49)
at com.kenai.jffi.Foreign$InstanceHolder.<clinit>(Foreign.java:45)
at com.kenai.jffi.Foreign.getInstance(Foreign.java:103)
at com.kenai.jffi.Type$Builtin.lookupTypeInfo(Type.java:242)
at com.kenai.jffi.Type$Builtin.getTypeInfo(Type.java:237)
at com.kenai.jffi.Type.resolveSize(Type.java:155)
at com.kenai.jffi.Type.size(Type.java:138)
at jnr.ffi.provider.jffi.NativeRuntime$TypeDelegate.size(NativeRuntime.java:178)
at jnr.ffi.provider.AbstractRuntime.<init>(AbstractRuntime.java:48)
at jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:57)
at jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:41)
at jnr.ffi.provider.jffi.NativeRuntime$SingletonHolder.<clinit>(NativeRuntime.java:53)
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.Runtime$SingletonHolder.<clinit>(Runtime.java:82)
at jnr.ffi.Runtime.getSystemRuntime(Runtime.java:67)
at jnr.unixsocket.SockAddrUnix.<init>(SockAddrUnix.java:46)
at jnr.unixsocket.SockAddrUnix$BSDSockAddrUnix.<init>(SockAddrUnix.java:185)
at jnr.unixsocket.SockAddrUnix.create(SockAddrUnix.java:174)
at jnr.unixsocket.UnixSocketAddress.<init>(UnixSocketAddress.java:53)
at com.timgroup.statsd.NonBlockingStatsDClient$5.call(NonBlockingStatsDClient.java:1073)
at com.timgroup.statsd.NonBlockingStatsDClient$5.call(NonBlockingStatsDClient.java:1070)
at com.timgroup.statsd.NonBlockingStatsDClient.staticAddressResolution(NonBlockingStatsDClient.java:1090)
at com.timgroup.statsd.NonBlockingStatsDClient.staticStatsDAddressResolution(NonBlockingStatsDClient.java:1100)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:283)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:171)
at com.timgroup.statsd.NonBlockingStatsDClient.<init>(NonBlockingStatsDClient.java:146)
at com.mortardata.mhc.metrics.StatsD.<init>(StatsD.java:20)
at com.mortardata.mhc.metrics.StatsD.<init>(StatsD.java:9)
at com.mortardata.mhc.metrics.StatsD$SingletonHolder.<clinit>(StatsD.java:28)
at com.mortardata.mhc.metrics.StatsD.getInstance(StatsD.java:32)
at com.mortardata.mhc.Main.main(Main.java:69)
at com.kenai.jffi.internal.StubLoader.load(StubLoader.java:270)
at com.kenai.jffi.internal.StubLoader.<clinit>(StubLoader.java:449)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.kenai.jffi.Init.load(Init.java:68)
at com.kenai.jffi.Foreign$InstanceHolder.getInstanceHolder(Foreign.java:49)
at com.kenai.jffi.Foreign$InstanceHolder.<clinit>(Foreign.java:45)
... 38 more
Finally, after some trial and error, what solved it for me was adding this dependency explicitely:
and then also adding jffi-1.2.18-native.jar manually since Ivy was not pulling it correctly for some reason.
So I think the dependency on JFFI should be either explicitly added to the POM or at least documented in the README.
Looks like java-dogstatsd-clientcorrectly specifies its dependency on jnr-unixsocket 0.18 which in turn depends on the stuff that caused me problems. So I think
it might not be an issue with java-dogstatsd-client itself but probably with the way jnr-unixsocket dependencies are specified or with my project setup.
The text was updated successfully, but these errors were encountered:
Hi,
I added
java-dogstatsd-client
2.6.1 to my Java 1.8 project using Ivy + Maven and then configured the client to send metrics via Unix socket. The project compiled successfully, however I started getting a bunch of runtime errors related to JFFI. I don't have all the stacktraces unfortunately but there were things like:Finally, after some trial and error, what solved it for me was adding this dependency explicitely:
and then also adding
jffi-1.2.18-native.jar
manually since Ivy was not pulling it correctly for some reason.So I think the dependency on JFFI should be either explicitly added to the POM or at least documented in the README.Looks like
java-dogstatsd-client
correctly specifies its dependency onjnr-unixsocket
0.18 which in turn depends on the stuff that caused me problems. So I thinkit might not be an issue with
java-dogstatsd-client
itself but probably with the wayjnr-unixsocket
dependencies are specified or with my project setup.The text was updated successfully, but these errors were encountered: