Forum: JRuby (LoadError) Could not load FFI Provider - when using jruby-core jars (1.7.4)

2cda9758c673339fc208518b9756479b?d=identicon&s=25 Colin Surprenant (Guest)
on 2013-06-20 20:03
(Received via mailing list)

I am getting this exception with FFI when using jruby-core jars but NOT
when using jruby-complete.jar:

org.jruby.exceptions.RaiseException: (LoadError) Could not load FFI
Provider: (NotImplementedError) FFI not available: Could not initialize
class com.kenai.jffi.Foreign$InstanceHolder

It seems that the libffi libraries are not included in any of the
jruby-core jars. The following is included in jruby-complete.jar but NOT
any of the jruby-core jars:


I am trying to figure how I could include these into my dependencies
alongside the jruby-core jars. Any ideas?

5993756d2b69ce0bc16df3318c240d54?d=identicon&s=25 Wayne Meissner (Guest)
on 2013-06-21 01:15
(Received via mailing list)
It depends on what dependency management you're using.

If maven-ish (or anything that can use a maven repo, such as gradle,
ivy, etc), then add a dependency on com.github.jnr:jffi, something


Or, just download and add
to your classpath.
2cda9758c673339fc208518b9756479b?d=identicon&s=25 Colin Surprenant (Guest)
on 2013-06-21 07:46
(Received via mailing list)

I am using the jruby-core 1.7.4 artifact as a dependency which depends
jffi 1.2.5 so jffi-1.2.5.jar is downloaded but not

I am using Ivy and currently stuck at trying to include
jffi-1.2.5-native.jar as an extra dependency.

5993756d2b69ce0bc16df3318c240d54?d=identicon&s=25 Wayne Meissner (Guest)
on 2013-06-21 09:07
(Received via mailing list)
Ahh, thats a fairly easy fix - since the binaries are packaged
separately to the main pom, you need an explicit dependency on the
native assembly.


Why that isn't in jruby-core itself, or at least getting pulled in via
the jruby-core -> jnr-ffi dependency chain, I'm not too sure.
C37cb1a6a19e23f067aae6ccb2d0de4b?d=identicon&s=25 Manuel Ramos (Guest)
on 2013-06-21 10:37
(Received via mailing list)
Hi I think that core jar dont include things thats not core ... For a
with dependeces its better to use complete jar and then include
jars at classpath. I think that this includes could be posible even with
core but things will be more difficult... Because you must do again work
thats someone did to bundle complete jar container.

El 20/06/2013 20:03, "Colin Surprenant" <>
B05d3cbc64b0031a24c2887fb6ddc173?d=identicon&s=25 kristian (Guest)
on 2013-06-21 11:17
(Received via mailing list)
the jruby-core artifact should pull in exactly the same jars as
jruby-complete artifact.

looking at
$mvn dependency:tree
[INFO] \- org.jruby:jruby-core:jar:1.7.4:compile
[INFO]    +- org.jruby:jruby-stdlib:jar:1.7.4:compile
[INFO]    +- org.jruby.joni:joni:jar:2.0.0:compile
[INFO]    +- com.github.jnr:jnr-netdb:jar:1.1.2:compile
[INFO]    +- com.github.jnr:jnr-enxio:jar:0.4:compile
[INFO]    +- com.github.jnr:jnr-unixsocket:jar:0.3:compile
[INFO]    +- com.github.jnr:jnr-posix:jar:2.5.2:compile
[INFO]    +- org.jruby.extras:bytelist:jar:1.0.10:compile
[INFO]    +- com.github.jnr:jnr-constants:jar:0.8.4:compile
[INFO]    +- org.jruby.jcodings:jcodings:jar:1.0.10:compile
[INFO]    +- com.github.jnr:jffi:jar:1.2.5:compile
[INFO]    +- org.yaml:snakeyaml:jar:1.11:compile
[INFO]    +- jline:jline:jar:2.7:compile
[INFO]    +- joda-time:joda-time:jar:2.1:compile
[INFO]    +- com.jcraft:jzlib:jar:1.1.2:compile
[INFO]    +- com.headius:invokebinder:jar:1.2:compile
[INFO]    \- com.github.jnr:jnr-ffi:jar:1.0.4:compile
[INFO]       +- com.github.jnr:jffi:jar:native:1.2.7:runtime
[INFO]       \- com.github.jnr:jnr-x86asm:jar:1.0.2:compile

with a pom with only jruby-core as depdenceny. this shows that
com.github.jnr:jffi:jar:native:1.2.7:runtime is pulled in by the

so I am still sure that jruby-core+transitive dependencies is
the same as jruby-complete. could it be that there is loading issue of
native lib - just guessing ?

- christian
2cda9758c673339fc208518b9756479b?d=identicon&s=25 Colin Surprenant (Guest)
on 2013-06-21 20:13
(Received via mailing list)
ah-ah! classifier! thanks, I got it to include the native dependency and
for the record here's my Ivy config:

    <dependency org="org.jruby" name="jruby-core" rev="1.7.4"
conf="default" />
    <dependency org="com.github.jnr" name="jffi" rev="1.2.5"
      <artifact name="jffi" type="jar" />
      <artifact name="jffi" type="jar" m:classifier="native"/>

and "classifier" is needed in the retrieve pattern, with something like:

ant.retrieve "pattern" =>

2cda9758c673339fc208518b9756479b?d=identicon&s=25 Colin Surprenant (Guest)
on 2013-06-21 20:36
(Received via mailing list)
I am not very good with both Ivy & Maven so this might just be caused by
weakness with these tools... A basic transitive dependency on jruby-core
with Ivy like this:

<dependency org="org.jruby" name="jruby-core" rev="1.7.4" conf="default"

does not include jffi-native.

so looking at your dependency tree, jffi-native is in the maven
scope. I have tried without success to specify a runtime conf in Ivy to
include jffi-native. Again this might just be me not doing it right.

Manuel: jruby-complete can be useful but is not a good option when you
also dealing with other dependencies - with jruby-complete, it is not
possible to resolve conflicting jars etc.

B05d3cbc64b0031a24c2887fb6ddc173?d=identicon&s=25 kristian (Guest)
on 2013-06-21 20:48
(Received via mailing list)
it might very well be a Ivy thingy ;) great that you found a solution.

maybe it  is worth to declare com.github.jnr:jffi:jar:native:1.2.7 with
scope compile to keep the usage of jruby-core simple for Ivy users :)


On Fri, Jun 21, 2013 at 7:34 PM, Colin Surprenant <
This topic is locked and can not be replied to.