Tomcat installation instructions fail despite perfect deployment

Hello.

I can’t pass this set of instructions, despite doing everything perfectly and met the desired outcome:

The Nautilus application development team recently finished the beta version of one of their Java-based applications, which they are planning to deploy on one of the app servers in Stratos DC. After an internal team meeting, they have decided to use the tomcat application server. Based on the requirements mentioned below complete the task:

a. Install tomcat server on App Server 2.

b. Configure it to run on port 5001.

c. There is a ROOT.war file on Jump host at location /tmp.

This was my steps:

Log into App Server 2
ssh steve@stapp02

Install Java
sudo yum install java-11-openjdk -y

Install Tomcat

sudo mkdir -p /opt/tomcat
cd /opt/tomcat
wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.108/bin/apache-tomcat-9.0.108.tar.gz
tar -xzf apache-tomcat-9.0.108.tar.gz
mv apache-tomcat-9.0.108/* .
rm -rf apache-tomcat-9.0.108.tar.gz apache-tomcat-9.0.108

Configure Tomcat Port to 5001
sudo vi /opt/tomcat/conf/server.xml

In this line:
<Connector port="8080" protocol="HTTP/1.1"

Change 8080 to 5001:
<Connector port="5001" protocol="HTTP/1.1"

Copy ROOT.war from Jump Host
scp /tmp/ROOT.war steve@stapp02:/opt/tomcat/webapps/

Start Tomcat:

cd /opt/tomcat/bin
sudo ./startup.sh

And after that:
Tomcat started.

Check if it worked:
curl http://stapp02:5001

After that, I can see the output without any problems.

So, criterias has been met to this point:

  • :white_check_mark: Install Tomcat on App Server 2
  • :white_check_mark: Configure it to run on port 5001
  • :white_check_mark: Copy ROOT.war from Jump Host (/tmp/ROOT.war)
  • :white_check_mark: Deploy the app and verify it works

However when I click on the Check button, lab fails :face_with_diagonal_mouth:

Can anyone help me? I’ve done this lab like 5 times now.

Huge thanks in advance.

Hi @alain

Could you please share the course level and task name? I’ll check it.

Hi @raymond.baoly it is Day 11 - Install and Configure Tomcat Server

I am facing the same issue. I was able to curl the server on the suggested port (6400 in my case) and noticed the html page but the lab did not pass

Here’s how i did this task:

ssh steve@stapp02

Installed Tomcat on App Server 2 using:

sudo yum install tomcat -y

Edited server.xml to configure the connector port to 6400, ensuring Tomcat listens on the required custom port. Could not figure out where the configuration lived so had to research about the location.

From the Jump Host, I copied the ROOT.war file to Server 2’s /tmp directory:
scp /tmp/ROOT.war steve@stapp02:/tmp
I was trying to directly copy the war file into the webapps folder under tomcat directly but kept on getting permission denied error. Therefore, I copied it into /tmp directory and moved it in the following step.

Moved the WAR file to Tomcat’s webapps directory so it can auto-deploy:

mv /tmp/ROOT.war /var/lib/tomcat/webapps/

Then started the Tomcat service and verified its status

systemctl start tomcat
and then was finally able to curl http://stapp02:6400

This was tough for me to figure out.

Hope it helps the rest struggling with this task

1 Like

Hi @Kaptainjamjam @alain

Try following Vishesh’s steps and see if it works.

Hello @raymond.baoly. I’m gonna do it like @vishesh and see what happens, but it doesn’t make any sense to me. I’ve been specific with my steps and at the end of the day I’m able to properly curl the webapp. So, if at the end I successfully do it, the lab should pass, not fail.

Hi, I had the same problem I solved it by restarting tomcat from script in tomcat bin directory ./shutdown then run ./startup again and I think systemctl start/restart tomcat could work, too, but ensure the port currently used is the one specified in task afterwards.

sudo netstat -tlnp | grep <PORT>

Hi @alain
Are you changing the owner and group of the ROOT.war file?

Hi @alain
try these steps to install the tomcat
sudo dnf -y install tomcat tomcat-webapps # it will Java dependency so no need to install java
sudo systemctl enable --now tomcat
sudo systemctl status tomcat

and the other steps as you do just change the user and group of ROOT.war file to tomcat