Heroku的Play / scala应用程序停止运行

时间:2017-08-18 05:40:17

标签: scala ssl heroku playframework

在本地运行我的heroku应用程序时突然遇到此问题,我的Play / Scala应用程序无法运行。看到可能导致的此错误无法加载SSL上下文:

22:27:05 web.1   |  Caused by: com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING

Procfile:

web: target/universal/stage/bin/myapp -Dhttps.port=${PORT} -Dhttp.port=disabled -Dhttps.keyStore.path=conf/generated.keystore

我也在遥控器上遇到同样的错误。如果我在没有Heroku的情况下在本地运行应用程序,我就不会发现任何问题(sbt -Dhttps.port = $ 1 -Dhttp.port = disabled~run)。它不清楚它指的是什么配置属性。播放2.5.4版本。

完整日志:

$ heroku local web
[OKAY] Loaded ENV .env File as KEY=VALUE Format
22:26:38 web.1   |  2017-08-17 22:26:38,177 [debug] p.a.l.c.ActorSystemProvider - Starting application default Akka system: application
22:26:39 web.1   |  2017-08-17 22:26:39,289 [debug] p.a.d.s.DefaultSlickApi - Created Slick database config for key admin.
22:26:40 web.1   |  2017-08-17 22:26:40,049 [debug] p.a.d.s.DefaultSlickApi - Created Slick database config for key default.
22:26:40 web.1   |  2017-08-17 22:26:40,276 [info] play.api.Play - Application started (Prod)
22:26:40 web.1   |  2017-08-17 22:26:40,394 [info] p.c.s.NettyServer - Listening for HTTPS on /0.0.0.0:5000
22:27:05 web.1   |  2017-08-17 22:27:05,481 [error] p.c.s.NettyServer - cannot load SSL context
22:27:05 web.1   |  java.lang.reflect.InvocationTargetException: null
22:27:05 web.1   |      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
22:27:05 web.1   |      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
22:27:05 web.1   |      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
22:27:05 web.1   |      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
22:27:05 web.1   |      at play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:96)
22:27:05 web.1   |      at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:32)
22:27:05 web.1   |      at play.core.server.NettyServer.liftedTree1$1(NettyServer.scala:91)
22:27:05 web.1   |      at play.core.server.NettyServer.play$core$server$NettyServer$$sslEngineProvider$lzycompute(NettyServer.scala:90)
22:27:05 web.1   |      at play.core.server.NettyServer.play$core$server$NettyServer$$sslEngineProvider(NettyServer.scala:89)
22:27:05 web.1   |      at play.core.server.NettyServer$$anonfun$channelSink$1.apply(NettyServer.scala:158)
22:27:05 web.1   |  Caused by: com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING
22:27:05 web.1   |      at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:159)
22:27:05 web.1   |      at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:170)
22:27:05 web.1   |      at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184)
22:27:05 web.1   |      at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
22:27:05 web.1   |      at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:246)
22:27:05 web.1   |      at play.core.server.ssl.DefaultSSLEngineProvider.createSSLContext(DefaultSSLEngineProvider.scala:34)
22:27:05 web.1   |      at play.core.server.ssl.DefaultSSLEngineProvider.<init>(DefaultSSLEngineProvider.scala:24)
22:27:05 web.1   |      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
22:27:05 web.1   |      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
22:27:05 web.1   |      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
22:27:05 web.1   |  2017-08-17 22:27:05,531 [debug] application - Client Error: code: 400, msg: text is empty
22:27:05 web.1   |  2017-08-17 22:27:05,531 [debug] application - Request: GET /bad-request
22:27:05 web.1   |  2017-08-17 22:27:05,533 [debug] application -     content-type: None
22:27:05 web.1   |  2017-08-17 22:27:05,533 [debug] application -     headers: ArrayBuffer()
22:27:05 web.1   |  2017-08-17 22:27:05,533 [debug] application - Request: GET /bad-request
22:27:05 web.1   |  2017-08-17 22:27:05,534 [debug] application -     query string: 

$ find . -type f -name "*.keystore"
./conf/generated.keystore
./target/scala-2.11/classes/generated.keystore
./target/universal/stage/conf/generated.keystore
$

1 个答案:

答案 0 :(得分:0)

在关注帖子How to configure Play! 2.4.2 HTTPS keystore?后,我将Procfile更改为

web: target/universal/stage/bin/myapp -Dhttps.port=${PORT} -Dhttp.port=disabled -Dhttps.keyStore=conf/generated.keystore

它超过了这个错误。也就是说,我删除了#34; .path&#34;来自https.keyStore变量。