You are on page 1of 17

Apache Tomcat Course

Tutorial #2 - Deployer, Manager,


Realms & Access Control

Contents

Objective

Prerequisite

Chapters

Deployer

Manager

Realms and Access Control

Conclusion

Objective
The purpose of this tutorial is to
deploy, precompile, and validate web
application with standard and Manager
Web app ways and also Realms
configuration for use in web
applications that utilize Container
Managed Security.

Prerequisite

Basic Knowledge of Java technology


Basic Knowledge of Java Enterprise
Edition Java Servlets and Java
Server Pages technologies
Basic Knowledge of Windows 7
operating system
Basic Knowledge of Tomcat Web
Server

Ch#1 - Deployer

Topics
What is Deployment?
Deployment on Tomcat startup
Deploying on a running Tomcat
server

Ch#1 Deployer

cont'd

What is Deployment?

The process of installing a web


application into the Tomcat server.
Statically and Dynamically
A Context is what Tomcat calls a
web application.
The locations for Context Descriptors are:
$CATALINA_BASE/conf/[enginename]/[hostname]/
[webappname].xml
$CATALINA_BASE/webapps/[webappname]/METAINF/context.xml

Ch#1 Deployer

cont'd

Deployment on Tomcat startup

Default deployment
Set deployOnStartup attribute to
True
$CATALINA_BASE/conf/server.xml

Deploys web application on Tomcat


Startup

Ch#1 Deployer

cont'd

Deploying on a running Tomcat


server

Deploy and update web applications


dynamically
Set autoDeploy attribute to True
$CATALINA_BASE/conf/server.xml

Redeploy (as appropriate) when a


change is detected while Tomcat is
running

Ch# 2 - Manager

Topics

What is Manager?
Configuring Manager Application
Access
Deployment thru Manager

Ch#2 - Manager

cont'd

What is Manager?

Tomcat Manager Web application


http://localhost:8080/manager/html

Installed by default on context


path /manager

Supports different deployment


features

Ch#2 - Manager

cont'd

Configuring Manager Application


Access
Configure tomcat-users.xml which is
kept at $CATALINA_BASE/conf/
folder path
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret"
roles="admin-gui,manager-gui"/>

http://{host}:{port}/manager/html

Ch#2 - Manager

cont'd

Deployment thru Manager

Deploy A New Application Archive (WAR)


Remotely

Deploy A New Application from a Local


Path

Deploy a previously deployed webapp

Deploy a Directory or WAR by URL

Deploy a Directory or War from the Host


appBase

Deploy using a Context configuration

Ch#3 Realms and Access


Control

Topics

What is a Realm?
Configuring a Realm
Standard Realm Implementations

Ch#3 - Realms and Access


Control

What is a Realm?

A Realm is a "database" of
usernames and passwords that
identify valid users of a web
application (or set of web
applications), plus an enumeration
of the list of roles associated with
each valid user.

cont'd

Ch#3 - Realms and Access

cont'd

ConfiguringControl
a Realm

Adding an XML element to


conf/server.xml configuration file, that
looks something like this:
<Realm className="... class name for this implementation"
... other attributes for this implementation .../>

Ch#3 - Realms and Access

cont'd

Control

Standard Realm Implementations

JDBCRealm

UserDatabaseRealm

DataSourceRealm MemoryRealm
JNDIRealm

JAASRealm

Conclusion
We discovered the different
deployment and undeployment
approaches of Tomcat Web Server,
Tomcat Manager usage for Web
deployment and undeployment, and
Realm configuration for security with
demonstration .

You might also like