deployment folder

Download Report

Transcript deployment folder

Tomcat Setup
BCIS 3680 Enterprise Programming
Getting Web Apps to Work
Verify that Tomcat works.
Understand how context works.
Create folders/files for easy deployment of your web app.
Configure server.xml.
Configure web.xml.
Test your web app.






2
Starting Tomcat

Right-click the Windows start icon
Prompt (Admin).

In the “User Account Control” dialog box, click “Yes”.
3
; then select Command
Verification of Tomcat
At the command prompt, run this command: catalina run
Tomcat is up if you see “INFO: Server startup in #### ms”


4
Exiting Tomcat
To exit Tomcat, get back to the command console.
Press CTRL + C simultaneously.
When asked whether to terminate batch job, type y and hit ENTER.
You often need to stop and restart Tomcat after making changes to
configurations or class files.




5
Clean-Up
Once you are sure Tomcat starts properly, you may safely
delete the decompressed folder created in Slide #3 or
#4.

6
Alias for Web App
A web application consists of a collection of files that are
required to support a particular feature or task you want
to publish to the outside world. The set of files are
stored in a folder, which is the “deployment folder” for
the application. It can contain subfolders.
When provide visitors with the URL to your web app,
you don’t want to show them the physical path to the
deployment folder.
Instead, you create an “alias” (or “context” or “virtual
directory”) for the folder. In the URL, it is appended to
the server name.




7
Append any file names and/or subfolder names to the alias
when accessing files directly under the deployment folder or
under one of its subfolders.
Alias (Context)
This is what you want your
visitors to type and see . The
application appears to be the
\casej03 “subfolder” on the
server (localhost in this case)
8
Deployment Folder
This is what your visitors
DON’T see. This is where your
web application files are actually
located at.You don’t want
visitors to know it.
9
Folders for Deployment


Inside the deployment folder, create a subfolder called
WEB-INF.
For testing and assignments, download the web.xml file
into this subfolder.
10
Making the Connection
For each alias, you
need to add a new
<Context> tag under
the <Host> tag.
Set the value of the “docBase”
attribute of the <Context> tag
to your deployment folder
location.
11
You define what you want the user
to see (alias) as the “path” attribute
of the <Context> tag. Note the /
in front of the alias.
XML is casesensitive!
Setting Up a Context


One way to define an alias (context) is do it in the
server.xml configuration file.
server.xml is located in \<Tomcat Folder>\conf\.


In the course VM, it’s C:\Tomcat\conf.
You may use any editor that is capable of editing XML
files to open it.


12
In the course VM, use Notepad++.
If you use Windows Notepad, you will need to open it with
administrator rights. Otherwise you won’t be able to save the
changes you make.
Start NotePad with Admin Rights
Again, open
Notepad with
administrator
rights if you use
Windows Vista or
higher
13
Start NotePad with Admin Rights
14
Context for Web Applications

Unlike HTML, XML is case-sensitive!


Inside the “Host” element (tag), modify the “Context”
element. For example:
<Context path="/jsp" docBase="E:/BCIS
3680/jsp" />
Restart Tomcat.
15
Testing Web Site



After you have complete all the previous steps, you can
verify whether your web site is up and running by:
First, start Tomcat server from command prompt.
Second, open the browser and enter the following URL:
http://localhost:8080/<context>/default.htm
 Replace the <context> part with the alias you defined in the
server.xml file.
16
Testing localhost Site Under Win7/Vista
1
2
17
3