651.288.7000 info@intertech.com

This DevOps Tutorial is Part 5 of my series on Java Project Versioning. Check out the other articles:

Now that we have a consistent build pipeline from our last DevOps Tutorial, we will look at how to perform a Tomcat deployment without users experiencing any downtime.  For this tutorial I am going to walk you through using Maven to perform the build and deployment, and then later on this can be integrated into the pipeline to start down the path towards Continuous Deployment.

This DevOps Tutorial assumes that you have Tomcat 7 running as described in my Lightning Tutorial – Install Tomcat 7.

The server which I am using for this tutorial is named “quartz”.  Anywhere you see this name, you will need to change it to match your hostname.

Before we start, open a web browser and go to http://quartz:8080/SampleWebApp123

You will see something similar to:

DevOps Tutorial 1

Keep this browser open and edit the version in your pom.xml, to be 2.0-SNAPSHOT as shown below.


We can now deploy a new version of this sample web app to the same instance of Tomcat.

mvn clean package

mvn tomcat7:deploy

In a NEW browser, or in incognito mode if that is available in your browser go to http://quartz:8080/SampleWebApp123

You will see:

DevOps Tutorial 2

Refresh the first browser you will still see a version of 1.0-SNAPSHOT.  You can see that Tomcat has two versions of your web app running at the same time, Apache calls this “parallel deployment” and you can find more information here https://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment .  Once your session for version 1.0-SNAPSHOT expires, you will be directed to the 2.0-SNAPSHOT version.  You have now deployed a web application to Tomcat with zero downtime.

So long as versions of your web application are compatible with version of external resources such as a database, this will work. If however you remove a column from your database, this method will fail.  To work around this many development groups frequently add database columns, but only remove columns no longer needed a few times a year.

Miss the last few parts in this DevOps Tutorial? Catch up here:

DevOps Tutorial (Part 1): Introduction to Project Versioning with Maven

DevOps Tutorial (Part 2): Use Maven Release Plugin to Manage Versions

DevOps Tutorial (Part 3): Artifact Management

DevOps Tutorial (Part 4): Continuous Integration

Pin It on Pinterest

Share This

Like What You've Read?

Subscribe to the Blog.

Every Friday we send that week's content from our Developers via email. Try it out!

Some ad blockers can block the form below.

You have Successfully Subscribed!