Heroku - 项目全栈(Java 和 Angular)的构建成功结束,但在应用程序站点(运行)上出现“应用程序崩溃”

问题描述 投票:0回答:1

我对全栈和 Spring Boot 还很陌生,所以请耐心等待。 我使用一本用于全栈开发的书,我首先尝试理解地阅读它,然后运行其中的程序。每个计划都取得成功。现在我尝试将程序的最终状态(全栈:Java 和 Angular)放入 Heroku。 Heroku 中的程序构建成功,并且生成了应用程序的链接。在那里,当我打开它时,我总是看到“应用程序崩溃”。
在 Heroku 日志中我可以找到:

2024-05-14T12:07:28.000000+00:00 app[api]:由用户启动构建
2024-05-14T12:09:25.641787+00:00 app[api]: 发布由用户创建的 v78 2024-05-14T12:09:25.641787+00:00 app[api]: 由用户部署 73d058e8
2024-05-14T12:09:27.247829+00:00 heroku[web.1]:状态更改自 崩溃到开始 2024-05-14T12:09:42.000000+00:00 app[api]: Build 成功 2024-05-14T12:09:44.374861+00:00 heroku[web.1]: 开始 使用命令进行处理

java $JAVA_OPTS -cp target/classes superheroes/target/classes/com/example/springbootsuperheroes/superheroes/SuperheroesApplication
2024-05-14T12:09:45.149791+00:00 heroku[web.1]:进程退出 状态 1 2024-05-14T12:09:45.173646+00:00 heroku[web.1]:状态已更改 从启动到崩溃 2024-05-14T12:09:45.176281+00:00 heroku[web.1]:状态从崩溃变为启动 2024-05-14T12:09:45.048108+00:00 应用程序[web.1]:设置 JAVA_TOOL_OPTIONS 默认值基于 dyno 大小。自定义设置将覆盖它们。 2024-05-14T12:09:45.051956+00:00 应用程序[web.1]:已拾取 JAVA_TOOL_OPTIONS:-Xmx300m -Xss512k -XX:CICompilerCount = 2 -Dfile.encoding=UTF-8 2024-05-14T12:09:45.091937+00:00 app[web.1]: 错误: 无法找到或加载主类 superheroes.target.classes.com.example.springbootsuperheroes.superheroes.SuperheroesApplication 2024-05-14T12:10:01.270023+00:00 heroku[web.1]:启动进程 命令
java $JAVA_OPTS -cp target/classes superheroes/target/classes/com/example/springbootsuperheroes/superheroes/SuperheroesApplication
2024-05-14T12:10:02.022777+00:00 heroku[web.1]:进程退出 状态 1 2024-05-14T12:10:01.923530+00:00 应用程序[web.1]:设置 JAVA_TOOL_OPTIONS 默认值基于 dyno 大小。自定义设置将 覆盖它们。 2024-05-14T12:10:01.927897+00:00 应用程序[web.1]:已拾取 JAVA_TOOL_OPTIONS:-Xmx300m -Xss512k -XX:CICompilerCount = 2 -Dfile.encoding=UTF-8 2024-05-14T12:10:01.971485+00:00 app[web.1]: 错误: 无法找到或加载主类 superheroes.target.classes.com.example.springbootsuperheroes.superheroes.SuperheroesApplication 2024-05-14T12:10:02.042973+00:00 heroku[web.1]:状态更改自 开始崩溃 2024-05-14T12:10:03.892527+00:00 heroku[路由器]: at=错误代码=H10 desc="应用程序崩溃" method=GET path="/" 主机=anti-hero-fullstack-4cfbfc6dbb64.herokuapp.com request_id=187fc38d-b764-4519-86b3-6e485ca2927e fwd="83.23.236.21" dyno= 连接= 服务= 状态= 503 字节= 协议= https 2024-05-14T12:10:04.311456+00:00 heroku[路由器]: at=错误代码=H10 desc="应用程序崩溃" method=GET path="/favicon.ico" 主机=anti-hero-fullstack-4cfbfc6dbb64.herokuapp.com request_id=61fd7730-a803-414e-a35f-b184c1353445 fwd="83.23.236.21" dyno= 连接= 服务= 状态= 503 字节= 协议= https 2024-05-14T12:31:11.333043+00:00 heroku[web.1]:状态更改自 崩溃至 2024-05-14T12:31:30.395542+00:00 heroku[web.1]: 使用命令启动进程
java $JAVA_OPTS -cp target/classes superheroes/target/classes/com/example/springbootsuperheroes/superheroes/SuperheroesApplication
2024-05-14T12:31:31.120243+00:00 heroku[web.1]:进程退出 状态 1 2024-05-14T12:31:31.016516+00:00 应用程序[web.1]:设置 JAVA_TOOL_OPTIONS 默认值基于 dyno 大小。自定义设置将 覆盖它们。 2024-05-14T12:31:31.020366+00:00 应用程序[web.1]:已拾取 JAVA_TOOL_OPTIONS:-Xmx300m -Xss512k -XX:CICompilerCount = 2 -Dfile.encoding=UTF-8 2024-05-14T12:31:31.061166+00:00 app[web.1]: 错误: 无法找到或加载主类 superheroes.target.classes.com.example.springbootsuperheroes.superheroes.SuperheroesApplication 2024-05-14T12:31:31.143750+00:00 heroku[web.1]:状态更改自 开始崩溃



当我在 IntelliJ 中运行配置时,程序成功启动,但使用 localhost:8080。 我认为要么有一些超级简单但不正确的事情,要么有一些困难的事情。 我不确定是否应该有主类 .class 文件?我尝试生成它但没有成功。

我正在与这第四天作斗争,我尝试使用Procfile,使用我认为可能是正确的所有可能的路径组合以及很多其他东西。我最初将 pom.xml 文件放在 superheroes 项目路径中,但 Heroku 要求将其放在根路径中。请帮助我。

java spring-boot maven heroku angular-fullstack
1个回答
0
投票

您应该遵循 Heroku 文档来部署 Spring Boot 应用程序。

我的建议是执行以下操作:

  • 创建一个新的存储库
  • 按照 Heroku 文档教程创建一个新的 Spring Boot 应用程序,并使用此网页中列出的确切步骤部署最简单的应用程序版本 https://devcenter.heroku.com/articles/deploying-spring-boot-apps -to-heroku
  • 一旦您的应用程序运行 Heroku,现在您可以将代码从原始目录移动到工作 Heroku 应用程序存储库中。

我认为如果您遵循此流程,您的应用程序设置会更快。

祝你好运!

© www.soinside.com 2019 - 2024. All rights reserved.