java - Heroku - Java Maven 项目 depoly - 完成 git Push heroku master 后出现应用程序错误

标签 java git maven heroku deployment

我已经使用 Maven 制作了一个简单的 Java Web 应用程序,并且正在尝试部署它。首先,我遇到了一个错误:

error: src refspec master does not match any.
error: failed to push some refs to 'git@heroku.com: etc ...'

但是,我在这里找到了解决方案: I want make push and get error: src refspec master does not match any

过了一会儿,我在终端中收到以下信息:

remote:        [INFO] BUILD SUCCESS
remote:        [INFO] ------------------------------------------------------------------------
remote:        [INFO] Total time: 11.039 s
remote:        [INFO] Finished at: 2018-10-03T12:25:10+00:00
remote:        [INFO] Final Memory: 24M/172M
remote:        [INFO] ------------------------------------------------------------------------
remote: -----> Discovering process types
remote:        Procfile declares types -> (none)
remote:
remote: -----> Compressing...
remote:        Done: 63.5M
remote: -----> Launching...
remote:        Released v3
remote:        https://immense-falls-73440.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.

但是当我尝试 heroku open 或只是转到 URL 时,只有信息:应用程序错误。

这是我的 Heroku 日志:

2018-10-02T20:55:00.135902+00:00 app[api]: Release v1 created by user mymail@mail.com
2018-10-02T20:55:00.225698+00:00 app[api]: Enable Logplex by user mymail@mail.com
2018-10-02T20:55:00.225698+00:00 app[api]: Release v2 created by user mymail@mail.com
2018-10-02T20:55:00.135902+00:00 app[api]: Initial release by user mymail@mail.com
2018-10-02T20:56:51.945196+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=97651816-2e92-4196-add2-4cdd5325ca30 fwd="87.206.210.121"
dyno= connect= service= status=502 bytes= protocol=https
2018-10-02T20:56:52.583382+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=immense-falls-73440.herokuapp.com request_id=ca3e65a7-6ef1-4253-a946-2d0cc2e99dc1 fwd="87.20
6.210.121" dyno= connect= service= status=502 bytes= protocol=https
2018-10-02T20:56:52.583849+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=immense-falls-73440.herokuapp.com request_id=9ae591af-d87c-4224-9832-dff44ea68fd1 fwd="87.20
6.210.121" dyno= connect= service= status=502 bytes= protocol=https
2018-10-03T12:24:54.000000+00:00 app[api]: Build started by user mymail@mail.com
2018-10-03T12:25:18.147522+00:00 app[api]: Release v3 created by user mymail@mail.com
2018-10-03T12:25:18.147522+00:00 app[api]: Deploy 6d354e57 by user mymail@mail.com
2018-10-03T12:25:20.000000+00:00 app[api]: Build succeeded
2018-10-03T12:26:45.829110+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=8ebfefdc-d2a9-438d-a224-11f39ec21781 fwd="
87.206.210.121" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T12:26:46.544850+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=immense-falls-73440.herokuapp.com request_id=2af704d0-9703-4fe6-a173-2691ca0
fdd39 fwd="87.206.210.121" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T12:26:46.538716+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=immense-falls-73440.herokuapp.com request_id=11cd4e6d-f850-4687-bc6a-863f30e
667f8 fwd="87.206.210.121" dyno= connect= service= status=503 bytes= protocol=https

这是我第一次将任何 Java 项目部署到网络上,我很困惑,我真的不明白出了什么问题以及如何修复它。

添加Procfile后:java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

我再次遇到错误,这是我的日志:

2018-10-02T20:55:00.135902+00:00 app[api]: Release v1 created by user mymail@gmail.com
2018-10-02T20:55:00.225698+00:00 app[api]: Enable Logplex by user mymail@gmail.com
2018-10-02T20:55:00.225698+00:00 app[api]: Release v2 created by user mymail@gmail.com
2018-10-02T20:55:00.135902+00:00 app[api]: Initial release by user mymail@gmail.com
2018-10-02T20:56:51.945196+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=97651816-2e92-4196-add2-4cdd5325ca30 fwd="87.206.210.121"
dyno= connect= service= status=502 bytes= protocol=https
2018-10-02T20:56:52.583382+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=immense-falls-73440.herokuapp.com request_id=ca3e65a7-6ef1-4253-a946-2d0cc2e99dc1 fwd="87.20
6.210.121" dyno= connect= service= status=502 bytes= protocol=https
2018-10-02T20:56:52.583849+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=immense-falls-73440.herokuapp.com request_id=9ae591af-d87c-4224-9832-dff44ea68fd1 fwd="87.20
6.210.121" dyno= connect= service= status=502 bytes= protocol=https
2018-10-03T12:24:54.000000+00:00 app[api]: Build started by user mymail@gmail.com
2018-10-03T12:25:18.147522+00:00 app[api]: Release v3 created by user mymail@gmail.com
2018-10-03T12:25:18.147522+00:00 app[api]: Deploy 6d354e57 by user mymail@gmail.com
2018-10-03T12:25:20.000000+00:00 app[api]: Build succeeded
2018-10-03T12:26:45.829110+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=8ebfefdc-d2a9-438d-a224-11f39ec21781 fwd="
87.206.210.121" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T12:26:46.544850+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=immense-falls-73440.herokuapp.com request_id=2af704d0-9703-4fe6-a173-2691ca0
fdd39 fwd="87.206.210.121" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T12:26:46.538716+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=immense-falls-73440.herokuapp.com request_id=11cd4e6d-f850-4687-bc6a-863f30e
667f8 fwd="87.206.210.121" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T12:29:48.298049+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=4fe1f9d8-e616-4018-8f66-3496194563ee fwd="
87.206.210.121" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T12:32:38.432481+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=1b50b089-1aa9-449e-b2f2-7d10182e4955 fwd="
87.206.210.121" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T13:01:22.328331+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=83248761-74af-4fa4-b26b-f69a9d8da7b6 fwd="
156.114.128.11" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T13:01:23.283855+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=immense-falls-73440.herokuapp.com request_id=cdc081f2-193a-4490-8e79-7d2c6d8
725a3 fwd="156.114.128.11" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T13:22:47.102561+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=bc9ef838-d37d-4db5-9fb1-338bb5b4cdd2 fwd="
52.32.223.31" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T14:01:33.109607+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=bd761dab-f0fa-439f-9141-39581694d536 fwd="
156.114.160.11" dyno= connect= service= status=503 bytes= protocol=https
2018-10-03T20:09:40.000000+00:00 app[api]: Build started by user mymail@gmail.com
2018-10-03T20:09:57.925786+00:00 app[api]: Deploy 27d345c5 by user mymail@gmail.com
2018-10-03T20:09:57.925786+00:00 app[api]: Release v4 created by user mymail@gmail.com
2018-10-03T20:10:00.000000+00:00 app[api]: Build succeeded
2018-10-03T20:34:58.002908+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=immense-falls-73440.herokuapp.com request_id=4a875fae-4370-49e0-b1df-4c4ac578294b fwd="
87.206.210.121" dyno= connect= service= status=503 bytes= protocol=https

最佳答案

在你的构建日志中它说:

remote:        Procfile declares types -> (none)

这意味着 Heroku 不会启动任何进程,这就是您收到“没有正在运行的 Web 进程”错误的原因。

您的 Procfile 是什么样的?它可能是空的。你需要这样的东西:

web: java -jar target/myapp.jar

java 命令替换为适当的 java 命令以启动您的应用。

关于java - Heroku - Java Maven 项目 depoly - 完成 git Push heroku master 后出现应用程序错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52627339/

相关文章:

c# - 如何将整数参数的字符串表示形式返回为基数 16 的无符号整数

java - 从 native 代码访问 DoubleBuffer

java - JNI - C++/Java 中的监听器 - 是否可以在 C++ 中实例化 Java 对象并将它们用作参数

Github Action pull 请求不提供 github_sha 的最后一次提交

java - 从 xsd 为特定 xml 创建 JAVA 对象时获取 UnmarshalException

java - Spring Autowired 服务和 Controller 不工作

java - 如何在 Java 中将 n 列导出为 PDF 的标题?

linux - 致命 : git was built without support for git-add--interactive (NO_PERL=1)

git-p4 和分离的分支

java - GrizzlyHttpServerFactory.createHttpServer : Unable to perform operation: create on org. glassfish.jersey.server.wadl.processor.WadlModelProcessor