我想两个远程连接到不同的本地Akka ActorSystems
。我正在使用Scala 2.11.1和Akka 2.3.3。为什么我无法连接到远程演员系统?
我application.conf看起来是这样的:
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
}
的Actor
是非常直截了当。
import akka.actor._
class Consumer extends Actor {
def receive = {
case msg: String => println("Received: " + msg)
}
}
对于我使用的远程系统:
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")
}
最后我的本地系统的代码:
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"
}
我预计它将打印Received: test
。但相反,我收到错误消息。但相反,我收到以下错误消息:
java.lang.NoSuchMethodError: akka.actor.ActorSelectionMessage.wildcardFanOut()Z
我错过了什么?
其实我的classpath中有许多库的冲突版本。删除SBT缓存并重新导入真正的nessecary库后,这一切都运行得很完美。 –