You are on page 1of 31

Advance Java

Web Server Administration

LEVEL – PRACTITIONER
About the Author

Created By: Shanmu (105110)

Credential Sr Architect
Information:

Version and 1.0, January 02 2011


Date:

2
Icons Used

Hands on
Questions Tools Exercise

Coding Test Your Case Study


Standards Understanding

Best Practices
Demonstration & Industry
Workshop
Standards

3
Objectives

After completing this chapter you will be able to understand:


 How to install Web server?
 How to configure Web server in IDE?
 How to start/stop web server using command window?
 How to start/stop web server in IDE?
 How to deploy/start/stop applications?
 How to access the application?

4
Web Server Details

In this session you are going to learn about how to install/ configure and
administer Tomcat Web Server.

What is Tomcat Server?

Tomcat is a open source web server developed by Apache Software


Foundation. Tomcat is a container for applications built using
HTML/Servlets & JSP technologies.

5
For The Associates

This session should be independently done by associates. They


would have to follow each steps explained in the next few
slides in SDE and configure the web server. In case you have
problems please reach your trainer.

NOTE: This is a pre-requisite step before you move


on to Advance Java session.
So get the web server configured properly.

6
How to Install Tomcat Server

Step 1 : Download tomcat zip file.


Step 2 : Unzip the zip archive to a directory. Example: d:\CATP\Web Server

7
How to configure Web server in IDE?

Open the servers console in SDE.


Click the following menu
Windows Show View Other
In the window expand server and select servers.

You will get the below console opened.

8
How to configure Web server in IDE? (Cont)

Right click on the Server view  Click new Click Server

9
How to configure Web server in IDE? (Cont)

Select the Server version and click next

Note : In case the server version is not found in the list click download additional
server adapters to download the server adapter of your choice.

10
How to configure Web server in IDE? (Cont)

Click browse and select the server installation directory and click finish.

11
Server window after adding a server

The server window will be as shown below with the server you added listed.

Added Server

12
How to modify Server Configuration ?

The server configuration parameters like http port number , JRE in use etc can be
modified by using the window shown below.
In servers view (previous slide) double click on the server to get the below screen.

For example the


port number can be
changed here.

13
How to start web server in IDE?

In the servers view select the server and click the arrow icon to start the server

Starts the server.

The server starting logs can be seen as displayed in the window below

14
How to stop web server in IDE?

In the servers view select the server and click the red color square box to stop
the server

Stops the server.

15
How to administer server using external browser.

Follow the following steps to open a server in an external browser,

Step 1 : Change the server location using the server configuration file
Step 2 : Add a graphical user for the server by adding it in the tomcat-users.xml file

16
Step 1: Changing the Server location

Double click the server and open the server configuration file
Modify the server location as shown below.

Select the option “Use Tomcat


Installation”

17
Step 2: Modify tomcat user.xml

Add a graphical user in the tomcat-users.xml file which can be found inside the conf
folder inside the tomcat installation directory.

Example: D:\apache-tomcat-6.0.33\conf

<role rolename="manager-gui"/>
<user username="tomcat" password=“password.123" roles="manager-gui"/>

18
How to open Server Console in Browser?

Open a browser window and access the URL http://localhost:<portnumber>. The following
screen appears in the browser window. Click Tomcat Manager to manage the application in
the server.

19
How to open Server console in Browser? (Cont)

Enter the user name and password you configured in step 2 to log in to the manager
window.

20
Tomcat Manager Window

21
Application deployment in Server

To familiarize the deployment and running of an application import the following zip
file to your SDE.

Refer to the “Resources” section of


this Session for the attachment
“myApp.zip”

Use the SDE option for importing


existing project
Click File  import  Existing project
into workspace

22
How to start/deploy and run applications

Right Click the project  Click Run As  Click Run on Server .

23
How to start/deploy and run applications

Select the server and click finish.


The application will be deployed and started.

24
How to start/deploy and run applications

The page will be loaded in the internal browser window of SDE as


shown.

25
How to Deploy an Application using server console?

Open the Tomcat manager window and load the war file as shown below

Select the war file and


click Deploy. The
application will be
deployed and started.

26
Lend a Hand – Manually Deploying
Applications in server

For the demo we will first convert our application to a war file and then deploy it manually.
Create the war file of the application using eclipse export option.
Right Click the application File Export  War File

27
Lend a Hand – Manually Deploying
Applications in server

Enter the destination for the war file and click finish

28
Lend a Hand –Deploy the
application

Step 1 : Start the server from IDE


Step 2 : Open a browser window and call the server using
http://localhost:<portnumber>
Step 3 : Click Tomcat manager on the tomcat home screen and enter the login credentials.
Step 4 : In the manager window (Reference Slide) deploy the application by loading the war
file.
The application will be deployed and started. In the application list you can see your
application with status “running” as shown below.

The start ,stop , Reload ,Undeploy links can be


Click the link to launch used to start ,stop , Reload and Undeploy the
the application application respectively.

29
How to Start/Stop server using command window ?

Information: The server can also be started/stopped using the following .bat files
found the Tomcat server bin directory.
1. Startup.bat – To start the server
2. Shutdown.bat – To Stop the server

30
Advance Java

You have successfully completed -


Web Server basics.

You might also like