我有以下类,它创建一个演员系统并将配置作为代码中的字符串提供。但是,我得到了 netty 无法在默认主机和端口上启动的异常 - 当我向配置提供不同的值时
class RemoteActorSystemCreator extends ActorSystemCreator {
def create(name: String, hostName: String, port: String) = {
val string: Config = ConfigFactory.parseString(
s"""akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "$hostName"
port = $port
}
}
}"""
)
ActorSystem.create(name, ConfigFactory.load(string))
}
}
org.jboss.netty.channel.ChannelException: Failed to bind to: /127.0.1.1:2552
at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:298)
at akka.remote.netty.NettyRemoteServer.start(Server.scala:51)
at akka.remote.netty.NettyRemoteTransport.start(NettyRemoteSupport.scala:181)
org.jboss.netty.channel.ChannelException: Failed to bind to: /127.0.1.1:2552