【发布时间】:2019-02-15 20:34:27
【问题描述】:
我刚刚开始使用 Jhipster 并构建了一个标准应用程序(Maven、Postgres、Grunt、Sass、Java 8)。它在 Dev 中运行良好,但是当我运行 yo jhipster:heroku 命令,然后 cd 到 deploy/heroku 并运行 heroku open 时,浏览器会以 404 响应。
Postgres 数据库在 Heroku 上看起来很好(没有锁表)。后续运行 grunt deployHeroku 和 git push heroku master 并不能解决问题。
heroku 日志:
2015-04-26T13:29:36.053325+00:00 heroku[router]: at=info method=GET path="/" host=myapp.herokuapp.com request_id=c7f77c65-688f-45ac-90f4-aac54d0cea95 fwd="185.51.75.249" dyno=web.1 connect=2ms service=50ms status=404 bytes=4224
2015-04-26T13:29:36.331877+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=84eb4f79-9eda-4517-a60d-3fd25f2e6176 fwd="185.51.75.249" dyno=web.1 connect=1ms service=28ms status=200 bytes=5647
有趣的是网站图标和自定义 404 页面(我对其进行了修改以进行测试)本身工作正常。但是,所有路由都会导致 404。Heroku 日志表明应用正在运行。
更新 我使用 prod 配置在本地进行了 maven 构建并运行它:
mvn -Pprod package
mvn spring-boot:run
grunt serve
在我的开发机器上一切正常。此外,部署到 Cloud Front 的工作正常。
我可以提供任何想法或更多信息吗?
谢谢。
【问题讨论】:
-
t404 自定义 404 页面是 heroku 页面还是您的 java 应用程序的一部分?
-
@Robert - 这是我的应用程序的一部分。这是从
resources/templates/error.html中的服务器端模板提供的错误页面。 -
我收回端口建议。不过我会保留它。
-
您能否提供您在 Heroku 上的完整启动日志?它可能在 60 秒或更短的时间内没有启动。
-
我面临着完全相同的问题!有什么解决方法吗?