[英]Spring boot not working on Elastic Beanstalk
I'm new to spring boot and aws. 我是Spring Boot和Aws的新手。 I built a simple application with 2 endpoints that works fine when I run it locally on my mac.
我构建了一个带有2个端点的简单应用程序,当我在Mac上本地运行该应用程序时,它可以正常工作。
I followed the instructions from Spring while deploying my application. 部署应用程序时,我遵循了Spring的指示。 I setup an environment, generated a war file, and uploaded it.
我设置了一个环境,生成了一个war文件,并上传了它。 Before generating my war file, I changed the packing to "war" in my pom.xml file and changed the scope of spring-boot-starter-tomcat.
在生成war文件之前,我将pom.xml文件中的打包内容更改为“ war”,并更改了spring-boot-starter-tomcat的范围。 My beanstalk environment is running tomcat 8 and java 8 so under my project properties in my pom.xml file, I also set the Java version to 1.8 and tomcat version to 8.0.23.
我的beantalk环境正在运行tomcat 8和java 8,因此在pom.xml文件的项目属性下,我还将Java版本设置为1.8,将tomcat版本设置为8.0.23。
My war file uploads without an issue and my environment health is ok, but when I try to test one of the endpoints I keep getting a 404 error. 我的war文件上传没有问题,环境健康正常,但是当我尝试测试其中一个端点时,我一直收到404错误。 I'm really struggling with this and any help is appreciated.
我真的为此感到挣扎,任何帮助都值得赞赏。
I've solved the issue. 我已经解决了这个问题。 There was a bug with the way in which IntelliJ was generating my war file.
IntelliJ生成我的war文件的方式存在一个错误。 Instead, I needed to open terminal and enter:
相反,我需要打开终端并输入:
mvn package
To test it: 要测试它:
java -jar target/(my file name).war java -jar target /(我的文件名).war
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.