Search code examples
scalaakkaakka-cluster

How to fix all the errors and successfully run the Akka Distributed Workers Sample Project?


I am trying to run the Akka Distributed Workers project following the guide here https://developer.lightbend.com/guides/akka-distributed-workers-scala/

On run, it fails with series of error messages. The first one that caught my attention was:

14:42:36.747 [ClusterSystem-akka.actor.default-dispatcher-4] ERROR akka.cluster.ClusterActorRefProvider - No root guardian at [akka.tcp://[email protected]:2554]
java.lang.IllegalArgumentException: Wrong protocol of [akka.tcp://[email protected]:2554/], expected [akka]

Indeed when I take a look at the configuration "akka.tcp://[email protected]:2554" is used.

But why is the sample with the wrong format? Maybe the format changed?

Anyways I changed to "akka://[email protected]:2554" then attempted to run again...

The error about wrong protocol seems to be gone, but now I got the following error:

[error] (run-main-1) java.lang.IllegalStateException: Detected possible incompatible versions on the classpath. Please note that a given Akka version MUST be the same across all modules of Akka that you are using, e.g. if you use [2.6.0] all other modules that are released together MUST be of the same version. Make sure you're using a compatible set of libraries. Possibly conflicting versions [2.6.0, 2.5.23] in libraries [akka-persistence:2.6.0, akka-persistence-query:2.5.23, akka-coordination:2.6.0, akka-actor:2.6.0, akka-slf4j:2.6.0, akka-remote:2.6.0, akka-cluster:2.6.0, akka-protobuf-v3:2.6.0, akka-stream:2.6.0, akka-cluster-tools:2.6.0]

Which is also strange as I did not modify any of the dependencies...why does the sample project ship with incompatible versions for dependencies?

Anyways I noticed akka-persistence-query:2.5.23 is the offending one. it is version 2.5.23 instead of 2.6.0 like everyone else.

But there is no where akka-persistence-query is explicitly added. How then to correct the version?

Then the finally set of errors has to do with binding to ports:

java.lang.IllegalStateException: Failed to bind port 9042 on 127.0.0.1.
        at org.apache.cassandra.transport.Server.start(Server.java:160) ~[cassandra-bundle.jar:0.100-SNAPSHOT]
        at java.util.Collections$SingletonSet.forEach(Collections.java:4767) ~[na:1.8.0_161]

Not quite sure why this is error is occurring. Is it related to the prior version issue?

Well, I would appreciate insights from anyone more knowledeable than myself:

  1. Is changing the protocol URL actually the right thing to do?
  2. How to resolve the version incompatibility error?
  3. How to resolve the port error?

Solution

  • Ok, so after discussion with someone from Lightbend on the Gitter, It was discovered that the sample was temporary broken, and the upgrade to version 2.6.0 should not have been the case.

    I modified the version to 2.5.26 and everything works fine.

    An issue was opened to fix this here https://github.com/akka/akka-distributed-workers-scala.g8/issues/17