I have a Spring boot application that works fine on my localhost under Tomcat. When I pack it as a WAR and deploy to Elastic Beanstalk, I get only 404 pages. I tried a lot of different settings to try to get it to work, but I'm at a loss.
I configured the packaging as WAR, and IntelliJ generates an artifact:
<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>
I also included Tomcat as
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
The elastic Beanstalk server is a 64-bit Amazon Linux 2016.03 v2.2.0, working with Tomcat 8 Java 8
Local JVM is jdk1.8.0_71.jdk
Application Object:
@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............");
}
}
I have a control controller that I use to make sure everything works:
@RestController
public class HelloController {
@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}
}
... and it generates 404 errors.
.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/tomcat 8/webapps/ROOT .
META-INF/MANIFEST.MF :
-: 1.0
: xxxxxxxxxxx
: 0.0.1-SNAPSHOT
: cdc
--: com.xxxxxxxxx
: IntelliJ IDEA
Build-Jdk: 1.8.0_71
: com.xxxxxxxxx.WebappApplication
""
Environment health has transitioned from Info to Ok. Application update completed 58 seconds ago and took 15 seconds.
, AWS, .
, .
, ?
!