Error in starting tomcat7

I followed the instructions to install tomcat7 from https://wiki.openmrs.org/display/docs/Step+3±+Install+Tomcat. However, when I start the service, I am getting an error. Can anyone help me resolving this issue.

My OS: Pop!_OS 22.04 LTS (Ubuntu-based).

The error screenshot is attached as well.

Sorry , share the out puts of the above commands i.e service status and -xeu

1 Like

Looking at this phrase Job for tomcat.service failed because the control process exited with error code. kindly below are some options to follow to troubleshoot the error you are facing:

  1. kindly remove ‘/jre’ from JAVA_HOME in ‘tomcat.service’ file and the service will start. just incase it exists.

  2. Ensure Java version has not been updated automatically which changed the java path.

  3. Just incase you have added the following line in your tomcat service: Environment="JAVA_HOME=/usr/lib/jvm/default-java" kindly replace it with the actual version of java you are using to something like this Environment="JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64"

  4. Ensure you didn’t change the ownership for the files by running this command ls -lh in /opt/tomcat/logs directory Just incase the ownership was changed, change it back to tomcat by running the command below:

    sudo chown -R tomcat:tomcat catalina.out
    sudo chown -R tomcat:tomcat catalina_copy.out
    

    followed by sudo systemctl restart tomcat command to start the tomcat server.

  5. Make user tomcat owner of the whole tomcat directory: cd /opt && sudo chown -R tomcat tomcat/

Thank you so much for your detailed response. However I am having trouble finding the “tomcat.service file”. Steps I tried to find it:

  1. Check each and every subfolder of the /opt/tomcat7 folder to find the file.
  2. Check /etc/systemd/
  3. Check /usr/lib/systemd/system
Failed to start LSB: Start Tomcat...:

This message comes from the Linux Standard Base (LSB) init script, which is used to start and stop the service.

common caues;

  1. Port Conflicts: The Tomcat server might be configured to listen on a port that is already in use by another service. You can check which ports are in use on your system with the netstat command.
netstat -tulnp

2

as said by @jwnasambu

Misconfigured JAVA_HOME: Tomcat server needs correct JAVA_HOME environment variable to function properly. You can check if JAVA_HOME is set by running the following command:

echo $JAVA_HOME

And also permissions

Then to get more insight,

You can check the tomcat service log files, located in /var/log/tomcat* or /usr/local/tomcat/logs (path may vary depending on how tomcat was installed) for more information about the error, it will provide more detail about the problem.

In addition to checking the log files and troubleshooting the possible causes I mentioned above, you may also want to check the service’s init script (usually located in /etc/init.d/tomcat or /etc/systemd/system/tomcat.service ) and configuration files ( usually located in /etc/tomcat/ or /usr/local/tomcat/conf) for any issues that might prevent the service from starting.

Then;

oh sorry! @fenu28 kindly run systemctl restat tomcat and share the entire catalia.out logs using pastebin.

Kindly what is the output when you run java -version on your terminal?