2
votes

I have uploaded my war file with Spring application on AWS Beanstalk but it doesn't work. Everything works perfectly on my local machine with Tomcat. I tried setting environment variable PORT to 8080 but unfortunately nothing has changed. From my logs I get following issue:

2016/01/05 17:07:20 [error] 2704#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 89.73.213.69, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "sknera-vpzbac3zaq.elasticbeanstalk.com", referrer: "http://sknera-vpzbac3zaq.elasticbeanstalk.com/"

I also reviewed some other answer on that topic but none of them helped me.

2

2 Answers

3
votes

Looks like, the static content PATHs are hard coded to 127.0.0.1 in your code. That's why it was working fine in your local.

Look for 127.0.0.1 value in your code, and replace it with relative PATHs.

2
votes

Are you using Spring boot application created via Spring boot starter? If yes, check your pom.xml for the following dependency and add if needed
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>

Explanation: Spring boot starter comes with an embedded tomcat server. This might be causing the problem. Specifying "provided" scope might solve this problem