1

I successfully created publisher but failed to create subscriber by using the following:

    public static void main(String [] args)
    {
        ActorSystem system = ActorSystem.create("System");
        ActorRef subscriber = system.actorOf(new Props(Sub.class),   "subscriber");    
        subscriber.tell(new MyActor("CharlieParker", 50, 25), subscriber);
    }
    public class Sub extends UntypedActor 
    {
        ActorRef subSocket = ZeroMQExtension.get(getContext().system()).newSubSocket(
        new Connect("tcp://127.0.0.1:1237"),
        new Listener(getSelf()), Subscribe.all());
    }

Got this error: Uncaught error from thread [System-akka.zeromq.socket-dispatcher-7] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[System] java.lang.NoSuchMethodError: org.zeromq.ZMQ$Poller.poll(J)J at akka.zeromq.ConcurrentSocketActor$$anonfun$10.apply(ConcurrentSocketActor.scala:180) at akka.zeromq.ConcurrentSocketActor$$anonfun$10.apply(ConcurrentSocketActor.scala:179) at akka.zeromq.ConcurrentSocketActor.akka$zeromq$ConcurrentSocketActor$$doPoll(ConcurrentSocketActor.scala:197) at akka.zeromq.ConcurrentSocketActor$$anonfun$receive$1.applyOrElse(ConcurrentSocketActor.scala:46) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) at akka.actor.ActorCell.invoke(ActorCell.scala:386) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) at akka.dispatch.Mailbox.run(Mailbox.scala:212) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722)

What does it mean?

Hako
  • 361
  • 1
  • 2
  • 9

2 Answers2

2

I had the same type of error while trying to work with akka-zeromq and did some investigation on the subject. So the situation is the following: the error message states that it didn't find a method long poll(long timeout) in the class ZMQ.Poller (see this answer for the error message interpretation). This happens because of the following reasons

  1. Akka is built with zeromq-scala bindings.
  2. zeromq-scala is supposed to be compatible with jzmq , but unfortunately it's not at the moment because in scala bindings you have method long poll(long timeout) while in jzmq you have int poll(long timeout)

To overcome your problem locally you either have to rebuild Akka with zmq.jar, or use a quick and dirty workaround: change the return type for the method poll(long timeout) in jzmq ZMQ.Poller class and rebuild the java bindings. For more details and bindings compatibility discussion take a look here

However there is a global java/scala bindings compatibility problem, but it's outside of the scope of your question.

Community
  • 1
  • 1
Sergii Vozniuk
  • 222
  • 1
  • 11
0

it seems like you are either missing or having the wrong version of zeromq-scala-binding on your path.

Which version of akka and zeromq are you using?

Björn Antonsson
  • 1,019
  • 6
  • 9
  • I have built zeromq-3.2.2.tar(http://download.zeromq.org/zeromq-3.2.2.tar.gz) and jzmq-master(https://github.com/zeromq/jzmq). Copied generated zmq.jar to the project classpath and libraries seems to reside on my local: Hakan-MacBook-Pro:lib Hako$ ls | grep libjzmq libjzmq.0.dylib libjzmq.a libjzmq.dylib libjzmq.la Hakan-MacBook-Pro:lib Hako$ ls | grep libzmq libzmq.3.dylib libzmq.a libzmq.dylib libzmq.la – Hako Apr 30 '13 at 19:23
  • I have built this one also (after I read your comment): https://github.com/zeromq/libzmq and the problem still exists. – Hako Apr 30 '13 at 19:29
  • So now I see. Do you have the jzmq bindings in your classpath? Akka relies on the zeromq-scala-bindings available here https://github.com/valotrading/zeromq-scala-binding and they are not a drop in replacement for each other. – Björn Antonsson May 02 '13 at 10:04
  • Also, you shouldn't have to build any of these by yourself. If you just add the akka-zeromq artifact as a dependency to your maven or sbt project you should get all the necessary java/scala libraries. – Björn Antonsson May 02 '13 at 10:07
  • I have the same exact issue... with ZeroMQ 3.2.2 and trunk built for the dll and jar. No issue :-( – jts May 21 '13 at 10:12