Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

0MQ - JZMQ unsatisfied link error

I've installed 0MQ on a VM running CentOS and I have a C-based application happily working with it. However, I'm unable to get the Java application to work via JZMQ bindings. Here's the error I get:

java -Djava.library.path=/usr/local/lib -jar AidApps.jar receive localhost:9007
Starting the receiver application.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/local/lib/libjzmq.so.0.0.0: libzmq.so.1: 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:1750)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1675)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at org.zeromq.ZMQ.<clinit>(ZMQ.java:34)
at com.ijet.Receiver.main(Receiver.java:9)
at com.ijet.Main.main(Main.java:13)

I don't get any errors during installation of either 0MQ or JZMQ. I tried copying all libraries into /usr/local/lib but that didn't solve anything. Any ideas? This works on my Mac (so I know the JAR works), but not on the Linux box.

like image 505
Yuri Brigance Avatar asked Jun 20 '12 21:06

Yuri Brigance


2 Answers

Steps to fix this problem (credit goes to to J16-SDiZ):

1) cp /root/zeromq-2.1.11/src/.libs/*.* /usr/local/lib
2) nano /etc/ld.so.conf.d/zmq.conf
3) Add line /usr/local/lib and save
4) ldconfig
5) Verify by running ldconfig -v | grep zmq
6) Run the JAR java -Djava.library.path=/usr/local/lib/ -jar AidApps.jar receive localhost:9007

Note that the -Djava.library.path still needs to be specified, point it to the jzmq.jar file.

like image 53
Yuri Brigance Avatar answered Nov 16 '22 00:11

Yuri Brigance


This is because ld.so cannot resolve your libzmq.so.1.0.0.

Add the path /usr/local/lib to /etc/ld.so.config and run ldconfig to rebuild the cache.

like image 26
J-16 SDiZ Avatar answered Nov 16 '22 00:11

J-16 SDiZ