com.typesafe.config.ConfigException$WrongType:系统属性:路径的类型为 OBJECT 而不是 STRING
com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING
当我尝试构建 sbt 时:
sbt 运行 -Dhttps.port=9443 -Dhttp.port=禁用 -Dhttps.keyStore.type="JKS" -Dhttps.keyStore.password="密码" -Dhttps.keyStore.path=/cert/https-example.jks
显示错误:
--- (Running the application, auto-reloading is enabled) ---
[error] p.c.s.AkkaHttpServer - Cannot load SSL context
java.lang.reflect.InvocationTargetException: null
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:116)
at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:39)
at play.core.server.AkkaHttpServer.sslContext$lzycompute(AkkaHttpServer.scala:245)
at play.core.server.AkkaHttpServer.sslContext(AkkaHttpServer.scala:244)
at play.core.server.AkkaHttpServer.$anonfun$httpsServerBinding(AkkaHttpServer.scala:260)
at play.core.server.AkkaHttpServer.$anonfun$httpsServerBinding$adapted(AkkaHttpServer.scala:255)
Caused by: com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING
at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:164)
at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:175)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:194)
at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:251)
at play.core.server.ssl.DefaultSSLEngineProvider.createSSLContext(DefaultSSLEngineProvider.scala:37)
at play.core.server.ssl.DefaultSSLEngineProvider.<init>(DefaultSSLEngineProvider.scala:30)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[info] p.c.s.AkkaHttpServer - Listening for HTTPS on /0:0:0:0:0:0:0:0:9443
[error] com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING
[error] at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:164)
[error] at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:175)
[error] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
[error] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:194)
[error] at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:251)
[error] at play.core.server.ssl.DefaultSSLEngineProvider.createSSLContext(DefaultSSLEngineProvider.scala:37)
[error] at play.core.server.ssl.DefaultSSLEngineProvider.<init>(DefaultSSLEngineProvider.scala:30)
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[error] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[error] at play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:116)
[error] at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:39)
[error] at play.core.server.AkkaHttpServer.sslContext$lzycompute(AkkaHttpServer.scala:245)
[error] at play.core.server.AkkaHttpServer.sslContext(AkkaHttpServer.scala:244)
[error] at play.core.server.AkkaHttpServer.$anonfun$Http1Encrypted(AkkaHttpServer.scala:530)
[error] at scala.Option.map(Option.scala:242)
[error] at play.core.server.AkkaHttpServer.Http1Encrypted$lzycompute(AkkaHttpServer.scala:522)
[error] at play.core.server.AkkaHttpServer.Http1Encrypted(AkkaHttpServer.scala:520)
[error] at play.core.server.AkkaHttpServer.<init>(AkkaHttpServer.scala:564)
[error] at play.core.server.AkkaHttpServerProvider.createServer(AkkaHttpServer.scala:665)
[error] at play.core.server.AkkaHttpServerProvider.createServer(AkkaHttpServer.scala:663)
[error] at play.core.server.DevServerStart$.$anonfun$mainDev(DevServerStart.scala:311)
[error] at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
[error] at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:76)
[error] at play.core.server.DevServerStart$.mainDevOnlyHttpsMode(DevServerStart.scala:40)
[error] at play.core.server.DevServerStart.mainDevOnlyHttpsMode(DevServerStart.scala)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[error] at play.runsupport.Reloader$.startDevMode(Reloader.scala:311)
[error] at play.sbt.run.PlayRun$.devModeServer$lzycompute(PlayRun.scala:100)
[error] at play.sbt.run.PlayRun$.devModeServer(PlayRun.scala:83)
[error] at play.sbt.run.PlayRun$.$anonfun$playRunTask(PlayRun.scala:107)
[error] at play.sbt.run.PlayRun$.$anonfun$playRunTask$adapted(PlayRun.scala:67)
[error] at scala.Function1.$anonfun$compose(Function1.scala:49)
[error] stack trace is suppressed; run last Compile / run for the full output
[error] (Compile / run) java.lang.reflect.InvocationTargetException
[error] Total time: 5 s, completed 06-Apr-2022, 10:10:14 PM
[info] p.c.s.AkkaHttpServer - Stopping Akka HTTP server...
[info] p.c.s.AkkaHttpServer - Terminating server binding for /0:0:0:0:0:0:0:0:9443
[info] p.c.s.AkkaHttpServer - Running provided shutdown stop hooks
我尝试了我所知道的,但我找不到正确的答案。如果您对此有所了解,请帮助我..!为什么它不走这条路?我做错了什么吗?
我终于找到了正确的方法,我不知道为什么 application.conf
不起作用,但是在 build.sbt
中添加数据帮助我解决了这个错误。
PlayKeys.devSettings += "play.server.https.port" -> "9443"
PlayKeys.devSettings += "play.server.http.port" -> "disabled"
PlayKeys.devSettings += "play.server.https.keyStore.type" -> "JKS"
PlayKeys.devSettings += "play.server.https.keyStore.password" -> "password"
PlayKeys.devSettings += "play.server.https.keyStore.path" -> "https-example.jks"
数据已添加build.sbt
所以sbt run
中不需要添加数据
当我尝试构建 sbt 时: sbt 运行 -Dhttps.port=9443 -Dhttp.port=禁用 -Dhttps.keyStore.type="JKS" -Dhttps.keyStore.password="密码" -Dhttps.keyStore.path=/cert/https-example.jks
显示错误:
--- (Running the application, auto-reloading is enabled) ---
[error] p.c.s.AkkaHttpServer - Cannot load SSL context
java.lang.reflect.InvocationTargetException: null
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:116)
at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:39)
at play.core.server.AkkaHttpServer.sslContext$lzycompute(AkkaHttpServer.scala:245)
at play.core.server.AkkaHttpServer.sslContext(AkkaHttpServer.scala:244)
at play.core.server.AkkaHttpServer.$anonfun$httpsServerBinding(AkkaHttpServer.scala:260)
at play.core.server.AkkaHttpServer.$anonfun$httpsServerBinding$adapted(AkkaHttpServer.scala:255)
Caused by: com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING
at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:164)
at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:175)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:194)
at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:251)
at play.core.server.ssl.DefaultSSLEngineProvider.createSSLContext(DefaultSSLEngineProvider.scala:37)
at play.core.server.ssl.DefaultSSLEngineProvider.<init>(DefaultSSLEngineProvider.scala:30)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[info] p.c.s.AkkaHttpServer - Listening for HTTPS on /0:0:0:0:0:0:0:0:9443
[error] com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING
[error] at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:164)
[error] at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:175)
[error] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
[error] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:194)
[error] at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:251)
[error] at play.core.server.ssl.DefaultSSLEngineProvider.createSSLContext(DefaultSSLEngineProvider.scala:37)
[error] at play.core.server.ssl.DefaultSSLEngineProvider.<init>(DefaultSSLEngineProvider.scala:30)
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[error] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[error] at play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:116)
[error] at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:39)
[error] at play.core.server.AkkaHttpServer.sslContext$lzycompute(AkkaHttpServer.scala:245)
[error] at play.core.server.AkkaHttpServer.sslContext(AkkaHttpServer.scala:244)
[error] at play.core.server.AkkaHttpServer.$anonfun$Http1Encrypted(AkkaHttpServer.scala:530)
[error] at scala.Option.map(Option.scala:242)
[error] at play.core.server.AkkaHttpServer.Http1Encrypted$lzycompute(AkkaHttpServer.scala:522)
[error] at play.core.server.AkkaHttpServer.Http1Encrypted(AkkaHttpServer.scala:520)
[error] at play.core.server.AkkaHttpServer.<init>(AkkaHttpServer.scala:564)
[error] at play.core.server.AkkaHttpServerProvider.createServer(AkkaHttpServer.scala:665)
[error] at play.core.server.AkkaHttpServerProvider.createServer(AkkaHttpServer.scala:663)
[error] at play.core.server.DevServerStart$.$anonfun$mainDev(DevServerStart.scala:311)
[error] at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
[error] at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:76)
[error] at play.core.server.DevServerStart$.mainDevOnlyHttpsMode(DevServerStart.scala:40)
[error] at play.core.server.DevServerStart.mainDevOnlyHttpsMode(DevServerStart.scala)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[error] at play.runsupport.Reloader$.startDevMode(Reloader.scala:311)
[error] at play.sbt.run.PlayRun$.devModeServer$lzycompute(PlayRun.scala:100)
[error] at play.sbt.run.PlayRun$.devModeServer(PlayRun.scala:83)
[error] at play.sbt.run.PlayRun$.$anonfun$playRunTask(PlayRun.scala:107)
[error] at play.sbt.run.PlayRun$.$anonfun$playRunTask$adapted(PlayRun.scala:67)
[error] at scala.Function1.$anonfun$compose(Function1.scala:49)
[error] stack trace is suppressed; run last Compile / run for the full output
[error] (Compile / run) java.lang.reflect.InvocationTargetException
[error] Total time: 5 s, completed 06-Apr-2022, 10:10:14 PM
[info] p.c.s.AkkaHttpServer - Stopping Akka HTTP server...
[info] p.c.s.AkkaHttpServer - Terminating server binding for /0:0:0:0:0:0:0:0:9443
[info] p.c.s.AkkaHttpServer - Running provided shutdown stop hooks
我尝试了我所知道的,但我找不到正确的答案。如果您对此有所了解,请帮助我..!为什么它不走这条路?我做错了什么吗?
我终于找到了正确的方法,我不知道为什么 application.conf
不起作用,但是在 build.sbt
中添加数据帮助我解决了这个错误。
PlayKeys.devSettings += "play.server.https.port" -> "9443"
PlayKeys.devSettings += "play.server.http.port" -> "disabled"
PlayKeys.devSettings += "play.server.https.keyStore.type" -> "JKS"
PlayKeys.devSettings += "play.server.https.keyStore.password" -> "password"
PlayKeys.devSettings += "play.server.https.keyStore.path" -> "https-example.jks"
数据已添加build.sbt
所以sbt run
中不需要添加数据