【问题标题】:com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka.stream' when running jar filecom.typesafe.config.ConfigException$Missing:运行 jar 文件时未找到密钥“akka.stream”的配置设置
【发布时间】:2017-09-22 18:34:00
【问题描述】:

我正在尝试运行 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)

但我得到一个没有流部分的结果

你能帮忙吗?

【问题讨论】:

  • 你的myService.jar是超级罐子吗?
  • 配置是如何加载的?是由ActorSystem 处理还是您自己处理?
  • 可以肯定的是,ls -l /opt/myService/conf/application.conf 的结果是什么?
  • -rw-r--r-- 1 root root 4284 Sep 12 16:33 /opt/myservice/conf/application.conf
  • 如果我不带参数运行它,我会得到同样的错误。确实是个肥罐

标签: akka akka-stream


【解决方案1】:

java 命令行的语法是:

java [options] -jar filename [args]

此顺序很重要:您必须在 -jar 选项之前设置任何选项。

所以在你的情况下:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-28
    • 2015-09-04
    • 1970-01-01
    • 1970-01-01
    • 2015-09-09
    • 2017-10-29
    • 2023-03-21
    • 1970-01-01
    相关资源
    最近更新 更多