2012-09-11 51 views
0

我在初始化遠程IP地址上的actor系統時遇到了問題。我正在使用akka演員和戲劇!框架。代碼和遠程參與者系統都在遠程機架空間服務器上。當我嘗試在其他服務器上創建遠程參與者系統時,它無法綁定到該IP地址。我不認爲這是一個網絡或防火牆問題,因爲Rackspace說他們打開了服務器之間的所有連接。這是錯誤消息我得到:無法綁定到Akka Actor系統的遠程IP地址

[error] application - 

! Internal server error, for request [POST /payment/] -> 

java.lang.ExceptionInInitializerError: null 
    at  Routes$$anonfun$routes$1$$anonfun$apply$3$$anonfun$apply$4.apply(routes_routing.scala:44) ~[classes/:na] 
    at Routes$$anonfun$routes$1$$anonfun$apply$3$$anonfun$apply$4.apply(routes_routing.scala:44) ~[classes/:na] 
    at play.core.Router$HandlerInvoker$$anon$3.call(Router.scala:1080) ~[play_2.9.1-2.0.1.jar:2.0.1] 
    at play.core.Router$Routes$class.invokeHandler(Router.scala:1255) ~[play_2.9.1-2.0.1.jar:2.0.1] 
    at Routes$.invokeHandler(routes_routing.scala:14) ~[classes/:na] 
    at Routes$$anonfun$routes$1$$anonfun$apply$3.apply(routes_routing.scala:44) ~[classes/:na] 

Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /172.17.100.232:2554 
    at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:298) ~[netty-3.3.0.Final.jar:na] 
    at akka.remote.netty.NettyRemoteServer.start(Server.scala:53) ~[akka-remote-2.0.2.jar:2.0.2] 
    at akka.remote.netty.NettyRemoteTransport.start(NettyRemoteSupport.scala:73) ~[akka-remote-2.0.2.jar:2.0.2] 
    at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:95) ~[akka-remote-2.0.2.jar:2.0.2] 
    at akka.actor.ActorSystemImpl._start(ActorSystem.scala:568) ~[akka-actor-2.0.2.jar:2.0.2] 
    at akka.actor.ActorSystemImpl.start(ActorSystem.scala:575) ~[akka-actor-2.0.2.jar:2.0.2] 

Caused by: java.net.BindException: Cannot assign requested address 
    at sun.nio.ch.Net.bind(Native Method) ~[na:1.6.0_26] 
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126) ~[na:1.6.0_26] 
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59) ~[na:1.6.0_26] 
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.bind(NioServerSocketPipelineSink.java:140) ~[netty-3.3.0.Final.jar:na] 
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleServerSocket(NioServerSocketPipelineSink.java:92) ~[netty-3.3.0.Final.jar:na] 
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:66) ~[netty-3.3.0.Final.jar:na] 

我創建遠程演員系統在這裏:

object Payment extends Controller { 
    var goodies: AuthNetActorObject = null 

    val system = ActorSystem("RemoteCreation", ConfigFactory.load.getConfig("remotecreation")) 
    val myActor = system.actorOf(Props[authNetActor.AuthNetActorMain], name = "remoteActor") 
    ... 
} 

這裏就是我在Application.conf文件中定義remotecreation:

remotecreation{ #user defined name for the configuration 
    include "common" 
    akka { 
      actor{ 
        #serializer{ 
        #  proto = "akka.serialization.ProtobufSerializer" 
        #  daemon-create = "akka.serialization.DaemonMsgCreateSerializer" 
        #} 

        #serialization-bindings{ 
        #  "com.google.protobuf.GeneratedMessage" = proto 
        #  "akka.remote.DaemonMsgCreate" = daemon-create 
        #} 

        deployment{ 
          /remoteActor{ #Specifically has to be the name of the remote actor 
            remote="akka://[email protected]:2554" 
          #  router = "round-robin" 
          #  nr-of-instances = 10 
          #  target { 
          #    nodes = ["akka://[email protected]:2554", "akka://[email protected]:2554"] 
          #  } 
          } 
        } 
      } 
    } 
} 

這是我在定義中包含的common.conf文件:

akka { 

    actor { 
    provider = "akka.remote.RemoteActorRefProvider" 
    } 

    remote { 
     transport = "akka.remote.netty.NettyRemoteTransport" 
     log-received-messages = on 
     log-sent-messages = on 
     log-remote-lifecycle-events = on 

    netty { 
     hostname = "172.17.100.232"  #Broadcast IP address of remote system 
     port = 2554 
     log-received-messages = on 
     log-sent-messages = on 
      log-remote-lifecycle-events = on 

    } 
    } 
} 

回答

1

這可能意味着別的東西正在那臺機器上使用那個端口。登錄到該機器並以root用戶身份運行netstat -anp | grep 2554並查看該端口處於LISTEN狀態。如果是這樣,進程ID將在最後一列。

+0

感謝您的回覆!我ssh'ed到遠程機器,成爲超級用戶,並輸入該命令。沒有任何回報。而當我沒有grep時,我無法找到端口2554.我也嘗試netstat -l列出了所有偵聽端口,並且無法在那裏找到它。此外,似乎有些東西正在使用所有正在偵聽的端口。我會嘗試切換到其中一個並給你一個更新。謝謝你的幫助 :)。 – BRS

+0

是的,它無法綁定。我會盡力找到一個開放的。 – BRS

+0

好吧,我只需要在遠程IP和端口上創建應用程序服務。 https://groups.google.com/forum/?fromgroups=#!topic/akka-user/-QMuZPQHiF0 – BRS