Heroku环境导致Java / Nashorn / ReactJS应用程序崩溃

时间:2017-05-04 23:43:17

标签: javascript java heroku webpack nashorn

Github repo https://github.com/damorton/dropwizardheroku-webgateway

构建./gradlew stage

Heroku应用程序在构建和webpack阶段后使用heroku local在本地运行良好,但在Heroku环境中崩溃,因为应用程序无法读取构建的webpack阶段生成的bundle.js文件。

到目前为止

  • 使用heroku run bash登录Heroku应用程序并检查是否正在创建bundle.js文件。
  • 更新system.properties以使用与我的本地环境java.runtime.version=1.8.0_131
  • 类似的Java版本

Heroku记录

Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2017-05-05T10:55:43.963570+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
2017-05-05T10:55:45.617664+00:00 app[web.1]: INFO  [2017-05-05 10:55:45,613] org.eclipse.jetty.util.log: Logging initialized @1649ms
2017-05-05T10:55:45.696063+00:00 app[web.1]: INFO  [2017-05-05 10:55:45,695] io.dropwizard.server.SimpleServerFactory: Registering jersey handler with root path prefix: /
2017-05-05T10:55:45.696110+00:00 app[web.1]: INFO  [2017-05-05 10:55:45,695] io.dropwizard.server.SimpleServerFactory: Registering admin handler with root path prefix: /admin
2017-05-05T10:55:45.696230+00:00 app[web.1]: INFO  [2017-05-05 10:55:45,696] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: assets for path /assets/*
2017-05-05T10:55:59.241010+00:00 app[web.1]: InputString in is null with path assets/js/bundle.js
2017-05-05T10:55:59.243502+00:00 app[web.1]: Exception in thread "main" java.lang.NullPointerException
2017-05-05T10:55:59.243739+00:00 app[web.1]:    at java.io.Reader.<init>(Reader.java:78)
2017-05-05T10:55:59.243867+00:00 app[web.1]:    at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
2017-05-05T10:55:59.243967+00:00 app[web.1]:    at com.bitbosh.dropwizardheroku.webgateway.api.NashornController.read(NashornController.java:46)
2017-05-05T10:55:59.244023+00:00 app[web.1]:    at com.bitbosh.dropwizardheroku.webgateway.api.NashornController.<init>(NashornController.java:27)
2017-05-05T10:55:59.244096+00:00 app[web.1]:    at com.bitbosh.dropwizardheroku.webgateway.Main.run(Main.java:43)
2017-05-05T10:55:59.244149+00:00 app[web.1]:    at com.bitbosh.dropwizardheroku.webgateway.Main.run(Main.java:23)
2017-05-05T10:55:59.244212+00:00 app[web.1]:    at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:43)
2017-05-05T10:55:59.244255+00:00 app[web.1]:    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
2017-05-05T10:55:59.244306+00:00 app[web.1]:    at io.dropwizard.cli.Cli.run(Cli.java:75)
2017-05-05T10:55:59.244391+00:00 app[web.1]:    at io.dropwizard.Application.run(Application.java:79)
2017-05-05T10:55:59.244436+00:00 app[web.1]:    at com.bitbosh.dropwizardheroku.webgateway.Main.main(Main.java:26)

从日志中,应用程序正在抛出NullPointerException  这是由NashornController.java中的Nashorn引擎评估从Reader文件的InputStream创建的bundle.js

我无法弄清楚为什么它在本地工作正常,但在Heroku环境中崩溃。如果我不创建bundle.js文件并评估添加到捆绑包中的Javascript源代码,则一切正常。

0 个答案:

没有答案