Java application stops running after some time in Amazon AWS

Viewed 1801

I've an EC2 instance in AWS. The instance is in free trial for a year. I've deployed a java spring-boot application there. My database is in mysql. This is a light-weight application which doesn't require heavy resource and the APIs served are really simple.

But the problem is the application stops running suddenly without showing any error messages in its application log. I've added a logback which shows nothing.

So when I understand the server application has stopped running from the front end application. I immediately check my aws console and found the host is running fine, but the application in it has stopped. Then I had to run the application again using screen -S myapp java -jar myapp.jar and it runs again smoothly.

So how frequent the application stops running? I couldn't measure it. Sometimes it stops after running for two-three days. Sometimes after a week - it doesn't making any sense really.

The APIs served from the application are not frequently used actually. So is there any chance that the application in stopped forcefully by the aws host? Is there anything else that might be the reason for stopping the application without any error log?

Thanks in advance.

2 Answers

In my case I solved this issue by running the spring boot application as a service in the aws Linux machine. click here to know how to do that in Linux. also in my case I had to change the "ExecStart" attribute as follow :

ExecStart=/bin/bash /home/ubuntu/start-spring.sh

"/home/ubuntu/start-spring.sh" is the location of the "start-spring.sh" (bash command file). If the system is crashing while compiling a code or taking much time to respond than usual. In that case you need to increase RAM of the system.

Related