Back Up and Restore Tomcat

45 minutes
  • 4 Learning Objectives

About this Hands-on Lab

Welcome to this hands-on lab. Here, we are using Apache’s Tomcat, a Java-based application platform built around deploying and managing Java Web Applications. The server provided in this lab environment is running Red Hat Enterprise 8 and has Tomcat 9 pre-installed for you, available on port **8080**.

In this lab you will back up your Tomcat instance. Then you will break it by deleting one of the management GUI applications.

Afterward, you will restore the application from the backup you took earlier.

The Tomcat instance is located under `/usr/local/tomcat9`, and the files are owned by the `tomcat` user.

Your task is to restore the missing files from that backup, and get the Manager GUI application working again.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Test to Ensure You Can Access the Preconfigured Tomcat Instances on Port 8080

Use the Tomcat server’s public IP address and port 8080. Connect to the Tomcat GUI and log in. The username and password to use are the same as what’s provided for CLI access.

To access the server, copy the external IP address and test in your browser by using this IP address and appending the :8080 to it.

For example, if an IP address shown was 3.92.152.3, then you would put the following into your web browser:

http://3.92.152.3:8080

You should see the GUI. This is to test that Tomcat is up and running, and the lab is ready for you to perform the tasks. You will not be able to access the Manager GUI application. This is part of the lab.

Note: It may take from 3 to 10 mins after the Hands-On Lab has started before you can access the Tomcat server on Port 8080.

Logging In

Use the credentials provided on the hands-on lab overview page, and log in to the provided server as cloud_user. Note that this is for connecting to the server and also for the Tomcat GUI.

Back up Your Tomcat Application to a Folder Called /backups

First create the folder /backups.

Use the tar command (or whatever method you are comfortable with) and create a backup of the Tomcat application. You should put your backup in the /backups folder.

Tomcat is located under /usr/local/tomcat9.

Delete the Manager Application from /usr/local/tomcat9/webapps

Your Tomcat installation is located under /usr/local/tomcat9.

Delete the Manager application. It can be found under the /usr/local/tomcat9/webapps folder.

Test to make sure the Tomcat application is broken by going to your Tomcat server’s Manager address (something like http://3.92.152.3:8080/manager) via your web browser.

Restore the Entire Manager Folder to Your Tomcat Instance’s webapps Folder, Then Test to Make Sure It Works

Extract your backup file into the /backups folder.

Put back the manager folder that was deleted earlier from the /usr/local/tomcat9/webapps folder.

Move only that folder from /backups back into the Tomcat applications webapps folder.

When completed, you should see the following under the /usr/local/tomcat9/webapps/ folder:

docs
examples
host-manager
manager
ROOT

Test to make sure you can log into the manager application.

You should be able to see the Manager application when you go to your Tomcat server’s Manager address (something like http://3.92.152.3:8080/manager) via your web browser.

Again, the username and password are the same as for your lab username and password.

Additional Resources

While working with your Tomcat instance, a staff member accidentally removed the wrong application. They removed one of the apps provided by Tomcat to manage the server.

You have been tasked with restoring that management application from a backup. Restore only that application, not everything from the backup.

Once the manager application has been restored, test you can see the application on your Tomcat server and are able to log into it.

For this hands-on lab, you will create a backup of the Tomcat server. Then you will break it by deleting the Management application. Afterward, you will bring it back to operational status by extracting the backup you made, and restoring the deleted application.

Your Tomcat instance can be found under /usr/local/tomcat9.

You will complete the hands-on lab by performing the tasks as mentioned in the tasks list.

If the hands-on lab is successful, you will be able to log into the manager GUI application.

Note: It may take 3 to 10 minutes after the hands-on lab has started before you are able to log into the server. This is fine and will not affect the performance of the tasks for the hands-on lab.

Logging In

Use the credentials provided on the hands-on lab overview page, and log in to the provided server as cloud_user. Note that this is for connecting to the server and also for the Tomcat GUI.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?