Question

Droplet - Start Spring Boot Web Server with ubuntu service not working

Hi Everyone, I am experiencing a problem about starting my Spring Boot Web Server within a Droplet (Ubuntu 22.04 x64).

I have copied:

  • jar file into /artifact folder (root/artifact);
  • service file into /etc/systemd/system folder;

When I use the command to start the service from droplet ssh session and I check the status, the system shows this information:


● webserver-0.0.1-SNAPSHOT.service - Webserver 03motorsport Spring Boot Application
     Loaded: loaded (/etc/systemd/system/webserver-0.0.1-SNAPSHOT.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Fri 2023-10-27 16:40:29 UTC; 396ms ago
    Process: 13162 ExecStart=/usr/bin/java -jar /artifact/webserver-0.0.1-SNAPSHOT.jar (code=exited, status=1/FAILURE)
   Main PID: 13162 (code=exited, status=1/FAILURE)
        CPU: 1ms

The service remains in “activating” status, and my web server is not loading properly.

What I am doing wrong?

Thanks in advance for the help :)

Gianluca


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
October 30, 2023

Heya, @55bafd6b3fba46cb9d8e7bb64ea488

You can start by checking the logs, to see the logs of your service, you can use journalctl:

  1. journalctl -u webserver-0.0.1-SNAPSHOT -e

The command will display the logs for your service and should help you diagnose the issue.

Hope that this helps!

KFSys
Site Moderator
Site Moderator badge
October 30, 2023

Heya,

I can see the PID is with status FAILURE:

   Main PID: 13162 (code=exited, status=1/FAILURE)

The error message indicates that your Spring Boot application is failing to start. The service keeps trying to restart the application, which is why you see it in the “activating” status.

Inspect the Service Logs: The first thing you’d want to do is to check the logs to understand why your application is failing to start. You can send them over here for further help as well.

Test Manually: Try running the JAR file directly to see if it provides any error messages:

/usr/bin/java -jar /artifact/webserver-0.0.1-SNAPSHOT.jar

If there are any configuration issues or missing dependencies, running the application manually will often provide a more detailed error message.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel