Basic steps for deploying a Web Project War package to a Tomcat server

Source: Internet
Author: User

Reference Source:


1. Common sense: 1.1 War pack

The war package is generally a web development, usually a Web site project under all the source of the collection, which contains the foreground HTML/CSS/JS code, also contains Java code.

When developers debug all the code on their own development machine and pass it, they need to package the developer's source code into a war for release to the testers and future product launches.

The war package can be placed under Tomcat under the WebApps or Word directory, which can be automatically decompressed as the Tomcat server starts.

1.2 Tomcat Server

Tomcat server is a free open source Web application server, belongs to the lightweight application server, in small and medium-sized systems and concurrent access users are not widely used, is the first choice to develop and debug JSP programs, The latest servlet and JSP specifications can always be seen in Tomcat.

2. Configure the Java Runtime Environment 2.1 Download and install the JDK

Download the latest jdk: from the official website, install it after downloading, select the directory where you want to install the JDK. The JRE is included in the JDK, so there is no need to install the JRE separately.

2.2 Setting the JDK environment variable

Right-click on "Computer", click "Properties", click "Advanced System Settings" on the left side of the pop-up window and select "Advanced environment variable" in the Pop-up tab.

Assume that your local Java JDK installation location is:C:\Program files\java\jdk1.7.0_45.

Here, create a new 2 environment variable and edit the 1 existing environment variables. As follows:

new variable name: java_home;

Variable Value: You install the JDK installation directory, here for C:\Program files\java\jdk1.7.0_45.

New variable name: CLASSPATH

Variable Value:

.; %java_home%\lib;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar;%tomcat_home%\bin

(Note that there is a. Number at the front)

To edit the path of an environment variable:

Variable name: Path;

Variable value:%java_home%\bin;%java_home%\jre\bin;

(Paste the string here to the front of the variable value)

2.3 Verify that the JDK environment variable is set successfully

Click Start and enter cmd, enter: Java at the command line; Javac Java–version.

If you display the following information separately, your Java environment variable is already configured successfully.

Enter Java to display:

Input Javac, display:

Input java–version, display:

3. Deploying Tomcat Server 3.1 download tomcat to local hard drive

Download the Tomcat server from the official web. The files downloaded on the official website are all green and free of installation.


Unzip after download, such as E:\apache-tomcat-7.0.26.

3.2 Setting Tomcat environment variables

The Environment Variable dialog box that opens the computer is still the point.

Create a new environment variable:

Variable name: tomcat_home

Variable value: The directory after your Tomcat decompression, such as E:\apache-tomcat-7.0.26.

3.3 Verify that the configuration of the Tomcat environment variable is successful

Run the Bin/startup.bat in the Tomcat decompression directory to start the Tomcat server. Enter http://localhost:8080 in the address bar of any browser, indicating that Tomcat's environment variable is configured successfully if the interface is displayed as such.

The windows that Tomcat launches are:

4. Deploy the war package for the Web project to the Tomcat Server 4.1 FTP Get the War package and SQL script

Download daily building out of the latest project package from the local FTP server. After decompression is generally composed of two files, database folder and Projectname.war package.

By running the Xxxxx.sql script file in the database file, you can generate the most recent databases and table structure.

4.2 Configuring the virtual directory for a Web project

Copy the Projectname.war package to the webapp of Tomcat. When configured, the Access path is: http://localhost:8080/projectName/login.jsp.

Before accessing, you need to modify the configuration file of the Tomcat server to open:

Tomcat Unzip the directory \conf\context.xml. When you run the Web project, the database connection string that you want to configure is added to the XML file. The added context.xml are:


<!--Default set of monitored resources--


<!--uncomment this to disable session persistence across Tomcat restarts-


<manager pathname= ""/>


<!--uncomment this to enable Comet connection tacking (provides events

On session expiration as well as WebApp lifecycle)--


<valve classname= "Org.apache.catalina.valves.CometConnectionManagerValve"/>


(This is the database configuration that needs to be connected when this Web project is run.) )


4.3 Accessing the login page for a Web project

Once the connection string is set up, you can access the Web project based on the Tomcat server.

First run the Startup.bat in the Tomcat bin directory, and when Tomcat is started,

When the browser enters: localhost:8080/projectname/login.jsp, the login interface for the Web project appears, indicating that the war package was successfully deployed to the Tomcat server and successfully accessed.

Basic steps for deploying a Web Project War package to a Tomcat server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.