java.lang.UnsatisfiedLinkError: Unable to load library 'zmq': The specified module could not be found.

1,516 views
Skip to first unread message

Michael Slinn

unread,
Apr 18, 2012, 3:01:12 PM4/18/12
to akka...@googlegroups.com
I'm working on making a whole program from the Akka 2.0 ZeroMQ sample code. You can see the project on GitHub. It compiles fine, but when it runs I get:

[ERROR] [04/18/2012 11:53:38.22] [default-akka.actor.default-dispatcher-2] [ActorSystem(default)] Uncaught error from thread [default-akka.actor.default-dispatcher-2]
java.lang.UnsatisfiedLinkError: Unable to load library 'zmq': The specified module could not be found.

    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:145)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:188)
    at com.sun.jna.Library$Handler.<init>(Library.java:123)
    at com.sun.jna.Native.loadLibrary(Native.java:255)
    at com.sun.jna.Native.loadLibrary(Native.java:241)
    at org.zeromq.ZeroMQ$.loadLibrary(ZeroMQLibrary.scala:89)
    at org.zeromq.ZMQ.<clinit>(ZMQ.java:17)
    at akka.zeromq.ZeroMQExtension$.<init>(ZeroMQExtension.scala:34)
    at akka.zeromq.ZeroMQExtension$.<clinit>(ZeroMQExtension.scala)
    at akka.zeromq.package$.zeromqSystem(package.scala:18)
    at HealthProbe.<init>(HealthPublisher.scala:16)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at akka.actor.Props$$anonfun$apply$1.apply(Props.scala:46)
    at akka.actor.Props$$anonfun$apply$1.apply(Props.scala:46)
    at akka.actor.ActorCell.newActor(ActorCell.scala:488)
    at akka.actor.ActorCell.create$1(ActorCell.scala:506)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:593)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:208)
    at akka.dispatch.Mailbox.run(Mailbox.scala:177)
    at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:505)
    at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
    at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
    at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
    at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

[ERROR] [04/18/2012 11:53:38.27] [default-akka.actor.default-dispatcher-1] [ActorSystem(default)] Uncaught error from thread [default-akka.actor.default-dispatcher-1]
java.lang.NoClassDefFoundError: Could not initialize class akka.zeromq.ZeroMQExtension$
    at akka.zeromq.package$.zeromqSystem(package.scala:18)
    at Logger.<init>(HealthPublisher.scala:49)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at akka.actor.Props$$anonfun$apply$1.apply(Props.scala:46)
    at akka.actor.Props$$anonfun$apply$1.apply(Props.scala:46)
    at akka.actor.ActorCell.newActor(ActorCell.scala:488)
    at akka.actor.ActorCell.create$1(ActorCell.scala:506)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:593)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:208)
    at akka.dispatch.Mailbox.run(Mailbox.scala:177)
    at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:505)
    at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
    at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
    at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
    at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

What's that all about? I can see that zeromq-scala-binding_2.9.1-0.0.5.jar and akka-zeromq-2.0.1.jar are in the classpath. I thought it might be a Scala version issue and tried scalaVersion := "2.9.1" and scalaVersion := "2.9.1-1", but there was no change.

Mike

Derek Williams

unread,
Apr 18, 2012, 3:13:07 PM4/18/12
to akka...@googlegroups.com

Do you have zeromq installed? Not sure of the details as I haven't tried it, but I'm pretty sure you need the native library on your machine.

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/_3lHYjQYsicJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Michael Slinn

unread,
Apr 18, 2012, 4:05:02 PM4/18/12
to akka...@googlegroups.com
Somehow I had expected the jars to be sufficient to run 0MQ. Building on 64 bit Windows is painful without $pending $ with M$. Here is how I built for Ubuntu:

git clone git://github.com/zeromq/libzmq.git
cd libzmq
sudo apt-get install libtool autoconf automake uuid-dev e2fsprogs
less README
less INSTALL
./autogen.sh && ./configure && make && sudo make install

Mike

Michael Slinn

unread,
Apr 18, 2012, 4:16:48 PM4/18/12
to akka...@googlegroups.com
Now that 0MQ is installed on Ubuntu, sbt built the project and I got exactly the same error. :(

Michael Slinn

unread,
Apr 18, 2012, 4:24:13 PM4/18/12
to akka...@googlegroups.com
Solution:
(from libzmq directory):

sudo mv src/.libs/libzmq.so /usr/lib
sudo ldconfig -v

Now the program runs. It does not work yet, but at least I can debug it.

Mike

Michael Slinn

unread,
Apr 18, 2012, 5:46:46 PM4/18/12
to akka...@googlegroups.com
The Logger and HeapAlerter actors have subscribed to health and health.head ZMQMessages, but they are not receiving them. I added printlns and the output looks like:

Logger about to subscribe to health
HeapAlerter about to subscribe to health.heap
Entered HealthProbe preStart()
Logger got a Connecting
HealthProbe got a Tick
HealthProbe about to publish health.heap
HealthProbe about to publish health.load
HealthProbe got a Tick
HealthProbe about to publish health.heap
HealthProbe about to publish health.load
HealthProbe got a Tick
HealthProbe about to publish health.heap
HealthProbe about to publish health.load
...

There is no application.conf; I am using defaults. What's missing?

Mike

Michael Slinn

unread,
Apr 19, 2012, 9:09:30 PM4/19/12
to akka...@googlegroups.com
IT LIVES!

I wrote docs for anyone else who might want to build ZeroMQ and the Java bindings, then run the Akka-ZeroMQ demo.

https://github.com/mslinn/zeromq-demo#readme

It would be great if Sonatype would host the Java bindings (zmq.jar). I wonder how the request could be initiated?

Mike
Reply all
Reply to author
Forward
0 new messages