我在akka.remoting中遇到了一个奇怪的问题:当我直接运行" java ..... com.Main"时,远程机器上没有启动远程处理,所以远程actor系统没有在监听配置端口。但如果我在" sbt run"中运行,它会打开端口并听取它。可能有什么问题?
这是console.log: [dong @ ftlxsvr02 pipelinemanager] $ sbt run
[info]从/ mnt / fvg02vol8 / PipelineManager / test / pipelinemanager / project加载项目定义 [info]将当前项目设置为pipelinemanager(在构建文件中:/ mnt / fvg02vol8 / PipelineManager / test / pipelinemanager /) 检测到多个主要类,选择一个运行:
[1] com.pipelinemanager.Main [2] com.pipelinemanager.RemoteActorSystem
输入数字:2
[info]运行com.pipelinemanager.RemoteActorSystem [DEBUG] [07/22/2016 09:27:39.502] [run-main-0] [EventStream(akka:// RemoteSystem)] logger log1-Logging $ DefaultLogger started [DEBUG] [07/22/2016 09:27:39.504] [run-main-0] [EventStream(akka:// RemoteSystem)]默认记录器已启动 [INFO] [07/22/2016 09:27:39.615] [run-main-0] [akka.remote.Remoting]启动远程处理 [INFO] [07/22/2016 09:27:39.868] [run-main-0] [akka.remote.Remoting] Remoting开始了;监听地址:[akka.tcp:// RemoteSystem @ ftlxsvr02:9500] [INFO] [07/22/2016 09:27:39.870] [run-main-0] [akka.remote.Remoting] Remoting现在侦听地址:[akka.tcp:// RemoteSystem @ ftlxsvr02:9500] [INFO] [07/22/2016 09:27:39.887] [run-main-0] [akka.actor.ActorSystemImpl(RemoteSystem)] ##远程管道管理器应用程序启动## 远程管道管理器应用程序启动....
但是在JAVA中运行时,它不起作用:
[dong @ ftlxsvr02 pipelinemanager] $ java -classpath ./bin/pipelinemanager-0.0.6.jar com.pipelinemanager.RemoteActorSystem 远程管道管理器应用程序启动.... [INFO] [07/22/2016 09:31:39.494] [main] [akka.actor.ActorSystemImpl(RemoteSystem)] ## Remote Pipeline Manager App开始##
看到区别如下:
[DEBUG] [07/22/2016 09:27:39.502] [run-main-0] [EventStream(akka:// RemoteSystem)] logger log1-Logging $ DefaultLogger started [DEBUG] [07/22/2016 09:27:39.504] [run-main-0] [EventStream(akka:// RemoteSystem)]默认记录器已启动 [INFO] [07/22/2016 09:27:39.615] [run-main-0] [akka.remote.Remoting]启动远程处理 [INFO] [07/22/2016 09:27:39.868] [run-main-0] [akka.remote.Remoting] Remoting开始了;监听地址:[akka.tcp:// RemoteSystem @ ftlxsvr02:9500] [INFO] [07/22/2016 09:27:39.870] [run-main-0] [akka.remote.Remoting] Remoting现在侦听地址:[akka.tcp:// RemoteSystem @ ftlxsvr02:9500] 任何的想法? SBT运行行为是我需要的
在远程机器上启动actor系统的代码:
... `
object RemoteActorSystem{
def main(args: Array[String]) {
val fileName = "remotesystem.conf"
val configFile = getClass.getClassLoader.getResource(fileName).getFile
val config = ConfigFactory.parseFile(new File(configFile))
val remoteConfig = new RemotingConfig(fileName)
val system = ActorSystem(remoteConfig.systemName, config)
val defaultActor = system.actorOf(Props[RemoteActorSystem],
remoteConfig.className)
system.log.info("## Remote Pipeline Manager App Started ##")
}
}`