Question

How to resole code exited status 127

Posted April 7, 2021 1.7k views
DigitalOcean Cloud Firewalls

As I mentioned I’m unable to start tomcat server when i’m seeing status of tomcat server it is showing
Main PID: 2397 (code=exited, status=127)

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.

×
Submit an Answer
1 answer

Hi @raghuDolphin,

Status 127 can mean a variety of stuff. It’s not really an exit code from which we can fully provide a correct solution/direction.

What I’ll suggest is either checking the logs or your service’s status.

Let’s start with the status first. Try doing the following:

systemctl restart tomcat
systemctl status tomcat

In the status you should be able to see an error somewhere. What does this error say?

If you do not see the error, then turn your attention to Tomcat’s logs. By default logs should be stored in /var/log. Depending on your version the logs can be in

/var/log/tomcat6
/var/log/tomcat7
/var/log/tomcat8
/var/log/tomcat9

If you are not sure your version, you can type the following command to try and narrow it down:

find /var/log -name 'tomcat*'
find /var/log -name '*tomcat*'

In those logs, you should see the exact reason behind the failure. If you are not sure, you can always provide the error here and we’ll try and help out.

Regards,
KFSys

  • Haiii KFSys,
    As I restarted and checked status the error came like this,

    Loaded: loaded(/etc/systemd/system/tomcat.service; disabled ; vendor present: enabled)
    Active: activating (start) since {date-time}
    Process: 16631 ExecStop=/opt/tomcat/bin/shutdown.sh (code=exited,status=1/FAILURE)
    Main PID: 19628 (code=exited, status=127);control PID:19640 (catalina.sh)
    Task: 2 (limit: 1152)
    CGroup: /system.slice/tomcat.service
    19640 /bin/sh /opt/tomcat/bin/catalina.sh start
    19653 ps -p 19628

    {date-time} Starting Apache Tomcat Web Application Container…
    {date-time} Existing PID file found during start.