我正在为我的Web应用程序实现SSL连接。我有运行SBT时通过的密钥库。但是我得到的错误是“路径类型对象不仅仅是条纹”。
这样我传递密钥库: -
运行-Dhttp.port = disabled -Dhttps.port = 9448 -Dhttps.keyStore.path =“certs \ example.com.jks”-Dhttps.keyStore.type = JKS -Dhttps.keyStore.password = changeit
我收到以下错误: -
error] p.c.s.AkkaHttpServer - Cannot load SSL context
ava.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:103)
at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:35)
at play.core.server.AkkaHttpServer.$anonfun$httpsServerBinding$1(AkkaHttpServer.scala:126)
at play.core.server.AkkaHttpServer.$anonfun$httpsServerBinding$1$adapted(AkkaHttpServer.scala:124)
at scala.Option.map(Option.scala:146)
at play.core.server.AkkaHttpServer.<init>(AkkaHttpServer.scala:124)
aused by: com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRI
at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:159)
at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:170)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:246)
at play.core.server.ssl.DefaultSSLEngineProvider.createSSLContext(DefaultSSLEngineProvider.scala:34)
at play.core.server.ssl.DefaultSSLEngineProvider.<init>(DefaultSSLEngineProvider.scala:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
如果上面有任何问题,请告诉我。
答案 0 :(得分:1)
例外情况表明,你的一条路是错误的。
这是代码,发生了异常:
def createSSLContext(applicationProvider: ApplicationProvider): SSLContext = {
val httpsConfig = serverConfig.configuration.underlying.getConfig("play.server.https")
val keyStoreConfig = httpsConfig.getConfig("keyStore")
val keyManagerFactory: KeyManagerFactory = if (keyStoreConfig.hasPath("path")) {
val path = keyStoreConfig.getString("path") // HERE EXACTLY
如您所见,它需要一条路径,名为:play.server.https.keyStore.path
。
您似乎已将该路径配置错误:请检查您的application.conf
。
或调整您的运行命令。