Question

I'm trying to embed zeroMQ in my app, I followed this guideline to install ZMQ, so till here everything works fine. I have this line of code in my app:

ZMQ.Context m_context = ZMQ.context(1);

but above line of code raise below exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/libjzmq-812339378390536247.lib: libzmq.so.3: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at org.zeromq.EmbeddedLibraryTools.loadEmbeddedLibrary(EmbeddedLibraryTools.java:136)
    at org.zeromq.EmbeddedLibraryTools.<clinit>(EmbeddedLibraryTools.java:22)
    at org.zeromq.ZMQ.<clinit>(ZMQ.java:38)
    at com.castaclip.verticals.Messenger.<init>(Messenger.java:125)
    at com.castaclip.verticals.PushMessenger.<init>(PushMessenger.java:30)
    at com.castaclip.verticals.pushserver.App.setup(App.java:60)
    at com.castaclip.verticals.pushserver.App.main(App.java:41)

The error is exactly pointing to this line.

P.S: its a little bit difficult to fully explain this question.. if you have any question plz let me know. thanks.

Was it helpful?

Solution

If you've successfully built libzmq and jzmq in that order, I would run:

$ sudo ldconfig

to update the system library cache. Then I would check to see if LD_LIBRARY_PATH is defined like Raffian mentioned, or set your library path explicitly to something like:

$ java -Djava.library.path=/usr/lib:/usr/local/lib

OTHER TIPS

Finally I tried to figure out the problem. I was using zeromq-2.1.10 and this was part of the problem.

So I installed zeromq-3.2.3 from the source and problem resolved.

I encountered a mystifying instance of this message when I:

# java -Djava.library.path=/usr/hf/zmq/lib/ -cp '/usr/hf/lib/*:.' com.zmqtest.MA
Exception in thread "main"
java.lang.UnsatisfiedLinkError: /usr/hf/zmq/lib/libjzmq.so:
libzmq.so.3: cannot open shared object file: No such file or directory

which was fixed with a solution that makes no sense at all to me:

# LD_LIBRARY_PATH=/usr/hf/zmq/lib/ java -Djava.library.path=/usr/hf/zmq/lib/ -cp '/usr/hf/lib/*:.' com.zmqtest.MA

wierd.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top