在本地 tomcat 上运行的 Spring Boot 应用程序在 Elastic Beanstalk 上提供 404

Posted

技术标签:

【中文标题】在本地 tomcat 上运行的 Spring Boot 应用程序在 Elastic Beanstalk 上提供 404【英文标题】:Spring boot application which works on local tomcat gives 404 on Elastic Beanstalk 【发布时间】:2020-10-23 01:38:24 【问题描述】:

我的 Spring Boot 应用程序在我本地安装的 Tomcat 服务器上运行良好。但是,当我将相同的 WAR 部署到 Elastic Beanstalk 并单击给定的 URL 时,我得到的只是 404。我的 Spring Boot 应用程序中没有指定的路由在这里工作。可能的原因是什么?

server.port = 5000

【问题讨论】:

您是否检查了 AWS CDN 配置。也尝试在调试模式下启用日志并检查 我想我现在没有使用 CDN。我所做的只是简单地部署到 Elastic BeanStalk 您是否按照documentation中提到的说明进行操作? @sachin-titus elastibeanstalk 默认使用 CDN @ArvindKumarAvinash 是的,我按照原样遵循了文档 【参考方案1】:

如果您已将应用程序部署为 ROOT.war,那么我猜基本路径将是 myapp.elasticbeanstalk.com/ 或者如果它是直接位于其下方的路径(例如 app2.war),那么它将在 myapp 上运行。 elasticbeanstalk.com/app2/

Doc

【讨论】:

以上是关于在本地 tomcat 上运行的 Spring Boot 应用程序在 Elastic Beanstalk 上提供 404的主要内容,如果未能解决你的问题,请参考以下文章

Spring STS Spring Tools Suite 端口问题 Tomcat 在 Windows 10 上

在 Tomcat 上使用 Spring Boot 进行身份验证

Vaadin Spring Projekt期望no-arg构造函数,只在tomcat上不是本地的

Tomcat 10 问题上的 Spring Boot 2.x

如何在带有嵌入式 tomcat 的 Spring Boot App 中设置域名

无法使用通过 Tomcat 部署的 Spring 应用程序来本地 MySQL 数据库