How To Deploy a Spring Webapp To Tomcat Server

This tutorial will guide you through the steps for deploying a plain spring web application to a tomcat server.

If you haven’t setup Tomcat server, you can follow the steps given below to set it up on a Ubuntu server.

Setting Up tomcat7 on Ubuntu

All the required steps for the configuration and setup is given below.

1. Update the server.

2. Install Tomcat7 from the repository.

3. Open /etc/default/tomcat7 and find JAVA_OPTS and replace the default value with the following.

4. Now, restart the tomcat service.

5. Now if you go to localhost:8080 you can see the default tomcat7 web page saying “It Works”.

Install Maven To Build the Project

You need some build tool to build the project and create a war file for deployment. If you dont have maven installed, install maven using the following command.

Deploying Spring Web App To Tomcat Server

Now you have tomcat and a build tool ready. Also, you might have your project file with the pom.xml file for maven.

  1. cd in your project folder where you have the pom.xml file and run the following command.

2. Once the project is built, you can get the war file from the target direcory in your project folder. Copy the tar file to /var/lib/tomcat7/webapps directory.

3. Restart the Tomcat server using the following command.

4. Thats it ! Your app is not deployed.

Now if you visit, <server ip>:8080/appname, you can view your running app.


Installing and Setting up a WordPress on RHEL 7 / CentOS 7

Basic Requirements Step 1: Connect to the server using key or user/password [crayon-5c4564c267a2e931909374/] Step 2:…

Read more

Often times you might want to launch more than one VM of a related application with different configurations. In this…

Read more

In this second series, you will learn about script debugging, conditional statements and case statements. Debugging…

Read more

Internet is huge! Help us find great content


The Best Tutorials & Tips to Speedup Your DevOps Workflow.

Created by Bibin Wilson.