2017-09-13 27 views
0

我試圖運行Akka流應用程序,但在Linux上運行時得到異常。

當我使用Windows調試器運行它時,它正在工作。

我想這兩個命令:

java -jar ./myService.jar -Dconfig.resource=/opt/myservice/conf/application.conf 
java -jar ./myService.jar -Dconfig.file=/opt/myService/conf/application.conf 

,但我得到以下異常:

發現鑰匙 'akka.stream'

application.conf文件中沒有配置設置:

akka { 
    event-handlers = ["akka.event.slf4j.Slf4jEventHandler"] 
    loglevel = "DEBUG" 
    actor { 
     debug { 
      # enable function of LoggingReceive, which is to log any received message 
      at 
      # DEBUG level 
      receive = on 
     } 
    } 

    stream { 
     # Default materializer settings 
     materializer { 
      max-input-buffer-size = 16 

      dispatcher = "" 

      subscription-timeout { 
       mode = cancel 
       timeout = 5s 
      } 

      # Enable additional troubleshooting logging at DEBUG log level 
      debug-logging = off 

      # Maximum number of elements emitted in batch if downstream signals large demand 
      output-burst-limit = 1000 

      auto-fusing = on 

      # Those stream elements which have explicit buffers (like mapAsync, mapAsyncUnordered, 
      # buffer, flatMapMerge, Source.actorRef, Source.queue, etc.) will preallocate a fixed 
      # buffer upon stream materialization if the requested buffer size is less than this 
      max-fixed-buffer-size = 1000000000 

      sync-processing-limit = 1000 

      debug { 
       fuzzing-mode = off 
      } 
     } 

     blocking-io-dispatcher = "akka.stream.default-blocking-io-dispatcher" 

     default-blocking-io-dispatcher { 
      type = "Dispatcher" 
      executor = "thread-pool-executor" 
      throughput = 1 

      thread-pool-executor { 
       fixed-pool-size = 16 
      } 
     } 
    } 

    # configure overrides to ssl-configuration here (to be used by akka-streams, 
    and akka-http – i.e. when serving https connections) 
    ssl-config { 
     protocol = "TLSv1.2" 
    } 
} 

ssl-config { 
    logger = "com.typesafe.sslconfig.akka.util.AkkaLoggerBridge" 
} 

我加:

println(system.settings.config) 

,但我得到不流部分

你能幫助的結果?

+0

是您'myService.jar'一位超級罐子? –

+0

如何加載配置?它是由'ActorSystem'處理還是你自己做? –

+0

可以肯定,ls -l/opt/myService/conf/application.conf的結果是什麼? –

回答

1

java命令行的語法是:

java [options] -jar filename [args] 

這種排序事項:必須在-jar選項之前設置的任何選項。

所以你的情況:

java -Dconfig.file=/opt/myService/conf/application.conf -jar ./myService.jar 
相關問題