shareef
shareef

Reputation: 9581

Why tomcat wont start with Failed to start apache tomcat web server tomcat.service: Control process exited, code=exited status=203

What i wanted to do

I installed fresh linux Ubuntu 16.04 to setup a test developing environment.

I wanted to install

  1. java 8
  2. tomcat 8

So i applied this tutorial and know that i dont have any previously java or tomcat installed before.

Tutorial for java 8 and tomcat 8 Tutorial 2 same as the before with some more little hints

What is the problem

When i reached the step of starting tomcat , it failed. Failed to start apache tomcat web server tomcat.service: Control process exited, code=exited status=203.

Failed to start apache tomcat web server tomcat.service: Control process exited, code=exited status=203

Upvotes: 5

Views: 64702

Answers (3)

CDM
CDM

Reputation: 517

MY OS: POP!_OS (linux)

For me it was because i pointed JAVA_HOME to the wrong location. i pointed it to the binary folder but it should just be the home directory where you installed java. heres the turtorial that i followed

https://www.vultr.com/docs/how-to-install-apache-tomcat-8-on-centos-7

it even helps you set up a tomcat user, although i changed just 3 variables. my entire systemd file is here

[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/java/jre1.8.0_261 # i accidently had it /jre.../bin instead of just /jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
# the linked article had the entire thing in quotes?
# but only the value needs to be in quotes
Environment=CATALINA_OPTS='-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment=JAVA_OPTS='-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target

Upvotes: 0

mohsen
mohsen

Reputation: 1716

alternatively you can just start tomcat by going to /path/to/tomcat/bin/ and running ./startup.sh

it will spit out all the variables it is using and you can configure your tomcat.service file accordingly.

Upvotes: 4

shareef
shareef

Reputation: 9581

How i tried to reproduce:

I followed the tutorial on a fresh virtual box on ubuntu 16.04.

And after i tried lot of the solution like the below:

  1. Playing with chmod and permissions.
  2. Un install and re install
  3. Updating my ubuntu
  4. Restarting my ubuntu
  5. Reloading services
  6. Double Quotation suggestions in .service paths in (/etc/systemd/system/tomcat.service).
  7. Commenting CATALINA_HOME line in .service file in (/etc/systemd/system/tomcat.service).
  8. Other googling solutions.

Solution:

From a very small comments from here ( Thanks for the hint )) ) After i got the fail i ran

You should run ‘journalctl -xn’ for more details about why Tomcat failed to start. Thanks.

It gave me the main reason here is screen shot and notice in RED.

Error with journalctl

  • ALL PATHS WAS WRONG ==> So i had to fix about five places for the right path... check Number 2 in Orange check image .

check number 2 orange

  • JAVA_HOME PATH was wrong ==> so to change and find the correct one do this

how to find java path

Then change in tomcat.service check this image again this time look at 1 in bold yellow it should point to JDK.

number two in orange

Result:

So, apparently i had the path wrong , and it WORKED.

Summary:

When applying some tutorial keep an eye when you extract tomcat or etc.. because it may differ.

Upvotes: 13

Related Questions