Question

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?

Was it helpful?

Solution 2

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?

OTHER TIPS

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.

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