Using Tomcat 8.5 with Eclipse Neon on Ubuntu

When you start learning Spring MVC development configuring Tomcat server in Eclipse Neon IDE can be a difficult task. This tutorial will help you setup your development environment.

Installing Tomcat 8.5

$ wget
  • To make things easier you will install Tomcat inside your home directory. I assume that you already installed Java on your box, if not now is the time to do this. To instal Java follow tutorial at webupd8.
$ # We will install Tomcat in $HOME/bin/tomcat

$ mkdir -p ~/bin/tomcat
$ tar xzvf ~/Downloads/apache-tomcat-8.5.6.tar.gz \
 -C ~/bin/tomcat/ \
  • Let’s check if everything is OK by starting Tomcat and opening http://localhost:8080 in your favorite browser:
$ cd ~/bin/tomcat/bin
$ ./ run
# To stop server press Ctrl+C

You should see Tomcat welcome page: Tomcat Welcome screen

  • Now we will add an administrator account on Tomcat server. This is not needed by Eclipse but it may come in handy when you will later want to play with Tomcat:
$ cd ~/bin/tomcat/conf
$ vim tomcat-users.xml

Now you must add the following line to tomcat-users.xml file:

<tomcat-users ...>
  <user username="admin" password="1234" roles="manager-gui,admin-gui"/>

Here we are creating admin user with 1234 password and we give him (or her) permissions to administration gui. Let’s start Tomcat again (using ./ run) and check that we can visit Tomcat manager page (located at http://localhost:8080/manager/html): Tomcat Welcome screen

Configuring Eclipse Neon

Before we start check that you have following plugins installed:

Now we must create new Server Runtime Environment. Go to Preferences -> Server -> Runtime Environment -> Add… Tomcat Welcome screen

Then specify path to your Tomcat installation (/home/user_name/tomcat) and optionally JRE (use Oracle Java 8 if available) and click Finish. Tomcat Welcome screen

There is no Tomcat 8.5 in my wizard (if you completed previous steps skip this secion)

There is a bug in Eclipse that prevents some users from seeing Tomcat 8.5 option in their wizards: Tomcat Welcome screen

The solution is simple, we manually change Tomcat version number say from 8.5.6 to and this will allow us to use newer Tomcat version with buggy Eclipse. More details can be found in this SO question.

Following script will will patch Tomcat server:

cd ~/bin/tomcat

# Create backup
cp ../lib/catalina.jar ../lib/catalina.jar.backup

# Create patch directory and extract catalina.jar there
mkdir patch && cd patch
jar xvf ../lib/catalina.jar

# Change version number
cd org/apache/catalina/util/
sed -i 's/8.5.6/'
cd ../../../../

# Pack patched files into jar
jar cvf catalina.jar .

# Overwrite old catalina.jar
cp ./catalina.jar ../lib/

# Cleanup
cd .. && rm -rf patch

After running script try to start Tomcat server to check if it is working. Then if everything is OK create new Runtime Environment in Eclipse using Tomcat 8 option.

Starting Tomcat from Eclipse

Open Servers window (press Ctrl+3 and write in search box Servers). Use link in Servers window to open New Server wizard and create a new server: Tomcat Welcome screen

You should see new server created: Tomcat Welcome screen

Click on server and choose Clean option, then click again and select Start. If you have Tomcat running in terminal (./ run) stop it before you start Tomcat via Eclipse. Console window should display various log entries from starting Tomcat. Now click on server and select Stop.

Now it’s time to restart Eclipse and check if everything works after restart.

Creating simple Spring MVC app

We will create simple Spring MVC application to check if everything is working. Let’s start by creating new Maven project (New Project -> Maven Project and check Create simple project): Tomcat Welcome screen Don’t forget to select WAR as packaging method.

Open your POM file in XML editor and add following lines to it:

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">


  <!-- Spring MVC and Servlet API -->

  <!-- enable java 8 -->

Then let’s add four more files to our project: Tomcat Welcome screen

package hellotomcat;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

public class HomeController {

    public String welcome(Model model) {
        model.addAttribute("greeting", "gretting!!!");
        model.addAttribute("tagline", "it works");
        return "welcome";
<!-- WEB-INF/web.xml -->

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns=""
<!-- DefaultServlet-servlet.xml -->

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
  xmlns:xsi="" xmlns:context=""
  <mvc:annotation-driven />
  <context:component-scan base-package="hellotomcat" />
    class="org.springframework.web.servlet.view.InternalResourceViewResolver ">
    <property name="prefix" value="/WEB-INF/jsp/" />
    <property name="suffix" value=".jsp" />
<!-- WEB-INF/jsp/welcome.jsp -->

<%@ taglib prefix="c" uri=""%>
	<link rel="stylesheet"
		<div class="jumbotron">
			<div class="container">

Now click on pom.xml select Run As -> Maven install, this should create hellotomcat-0.0.1-SNAPSHOT.war file in target directory.

Click on project select Run As -> Run Configurations, then select Apache Tomcat and press New button. Tomcat Welcome screen Click Apply and Close.

Click on project select Run As -> Run on Server: Tomcat Welcome screen and Finish.

Go to http://localhost:8080/hellotomcat/ and check if you see greetings. Now open HomeController file change text and save changes, after a few seconds refresh browser page - you should see your new text.