【问题标题】:akka ingoring configuration settingsakka ingoring 配置设置
【发布时间】:2013-06-15 04:11:45
【问题描述】:

我有以下类,它创建一个演员系统并将配置作为代码中的字符串提供。但是,我得到了 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

【问题讨论】:

    标签: scala akka typesafe


    【解决方案1】:

    您使用的是 Akka 版本 2.1.x,但配置是 2.2 格式。 对于 2.1.4,端口的配置属性是 akka.remote.netty.port

    【讨论】:

    • 是的,我自己才发现的。谢谢你
    猜你喜欢
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 2013-05-17
    • 2018-04-15
    • 1970-01-01
    • 1970-01-01
    • 2018-10-03
    • 2018-11-27
    相关资源
    最近更新 更多