tgr
tgr

Reputation: 3608

Why can't I connect to a remote actor system?

I am trying two connect to different local Akka ActorSystems remotely. I am using Scala 2.11.1 and Akka 2.3.3.

My application.conf looks like this:

akka {
  loglevel = "DEBUG"
  actor {
    provider = "akka.remote-RemoteActorRefProvider"
  }
  remote {
    enabled-transports = ["akka.remote.netty.tcp"]
    netty.tcp {
      hostname = "127.0.0.1"
      port = 2552
    }
  }
}
localConf {
  akka.remote.netty.tcp.port = 8448
}
remoteConf {
  akka.remote.netty.tcp.port = 4224
}

The Actor is pretty straight forward.

import akka.actor._

class Consumer extends Actor {
  def receive = {
    case msg: String => println("Received: " + msg)
  }
}

For the remote system I am using:

import akka.actor._
import com.typesafe.config.ConfigFactory

object RemoteStart extends App {
  val config = ConfigFactory.load()
  val system = ActorSystem("remoteSystem", config.getConfig("remoteConf").withFalBack(config))
  val actor = system.actorOf(Props[Consumer], name = "consumer")
}

And finally the code of my local system:

import akka.actor._
import com.typesafe.config.ConfigFactory

object LocalStart extends App {
  val config = ConfigFactory.load()
  val system = ActorSystem("loaclSystem", config.getConfig("localConf").withFallBack(config))
  val actor = system.actorSelection("akka.tcp://[email protected]:4224/user/consumer")
  actor ! "test"
}

I would expect that it will print Received: test. But instead I get error messages. But instead I get the following error message:

java.lang.NoSuchMethodError: akka.actor.ActorSelectionMessage.wildcardFanOut()Z

What am I missing?

Upvotes: 0

Views: 1257

Answers (2)

Viktor Klang
Viktor Klang

Reputation: 26597

You have conflicting versions of Akka on your classpath. NoSuchMethodErrors are almost always caused by that.

Upvotes: 2

Ryan
Ryan

Reputation: 7257

Did you add the akka-remote module to your build file?

http://doc.akka.io/docs/akka/2.3.4/intro/getting-started.html

Upvotes: 0

Related Questions