Deploying web applications with Tomcat Web Application Manager

In the previous article, i mentioned about deploying web applications with docker. In this one, i will be talking about working in localhost. Tomcat has an interface in which one can manage all the configurations, applications and setting easily. All we have to do is to create users. But of course to do that, our application must be using tomcat server.

Let’s start configuring our web application. If you have created a maven project, please right click to pom.xml and open settings.xml. It will be containing something like this;

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">


</settings>

You should add a proxy and a server for your web application. Please write a code like the following before </settings>

<servers>
    <server>
        <id>tomcat7</id>  //my tomcat is tomcat7
        <username>rozerin</username>
        <password>PASSWORD</password> //type a password in here
    </server>
</servers>
<proxies>
    <proxy>
        <id>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <username>rozerin</username>
        <password>PASSWORD</password> //type a password in here 
        <host>proxy.xxx.com</host>
        <port>8080</port>
        <nonProxyHosts>xxx.com</nonProxyHosts>
    </proxy>
</proxies>

For that part you are done. Now it is time to make arrangements for tomcat server.

Please open tomcat folder. You will see a conf folder. Open that too. You will see a tomcat-users.xml file. We must edit that file. Open the command line and enter into that file typing;

sudo nano <path_to_your_tomcat-users.xml_file>

Screenshot from 2015-10-07 17:00:41

Make sure that you have defined a manager-script role. In the password part, please write your password you have written in settings.xml file. And also make sure that your usernames are the same.

Now it is time to test our configurations. Open your web browser and type

localhost:8080/manager

or

127.0.0.1:8080/manager

You will be getting and authentication screen. Type your username and password. If there is no error you will get the interface for tomcat like following;

Screenshot from 2015-10-07 17:04:12

If you see this, you are done. The topic of my previous article was to deploy applications. At the bottom of the page, one can upload the war files easily. If you don’t, please check your tomcat-users.xml and settings.xml files. Probably the mistake is somewhere in those files or check your catalina logs.

That is all for now. Hope to see you in my next article 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s