我有一個Spring Boot應用,可以在Tomcat下的本地主機上正常運行。當我將它打包爲WAR並將其部署到Elastic Beanstalk時,我只能獲得404頁面。我嘗試了許多不同的調整,試圖讓它起作用,但我無所適從。AWS上的Spring Boot/Tomcat Elastic Beanstalk只顯示404頁面
我已經配置了包裝成一個WAR和IntelliJ生成該工件:
<groupId>com.ideaEngine</groupId>
<artifactId>app_deployment</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<start-class>com.xxxxxxxx.WebappApplication</start-class>
<java.version>1.8</java.version>
</properties>
我也包括Tomcat作爲
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
彈性豆莖服務器爲64bit亞馬遜的Linux 2016.03 V2.2.0運行Tomcat 8 Java 8
Localhost JVM is jdk1.8.0_71.jdk
應用對象是:
@SpringBootApplication
public class WebappApplication {
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(WebappApplication.class);
}
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(WebappApplication.class, args);
System.out.println("Running............");
}
}
我有使用,以確保一切的工作測試控制器:
@RestController
public class HelloController {
@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}
}
...和它產生404錯誤。
我有一個名爲.war文件作爲Webapp.war,並作爲ROOT.war,並試圖在.COM /和/ ROOT /和/的webapp/
他們全部產生404
訪問它日誌文件顯示,該應用被部署到服務器:
Deployment of web application directory /var/lib/tomcat8/webapps/ROOT has finished in 2,143 ms
所有文件都在/ var解壓/ lib中/ tomcat8時,它的部署/ webapps /目錄ROOT。
的META-INF/MANIFEST.MF似乎罰款: 清單-版本:1.0 實現-標題:XXXXXXXXXXX 的實現版本:0.0.1-SNAPSHOT 內置者:CDC 實現廠商ID: com.xxxxxxxxx 創建-者:IntelliJ IDEA的 內建的jdk:1.8.0_71 主類:com.xxxxxxxxx.WebappApplication
生讀作 「OK」
Environment health has transitioned from Info to Ok. Application update completed 58 seconds ago and took 15 seconds.
我一直在梳理與AWS上的部署有關的所有其他問題,並且已經空了。
同樣,應用程序在我的本地機器上運行良好。
任何想法,我失蹤了?
謝謝!
我遇到了同樣的問題,隊友。你有沒有想出一個解決方案? – LynchburgExplorer