How Tomcat projects are deployed

Source: Internet
Author: User

First, static deployment

1. Copy the Web project files directly into the WebApps directoryTomcat'sThe WebApps directory isThe Tomcat default app directory, which loads all applications under this directory when the server is started. So you can putjsp program packaged into a   The war package is placed in the directory, and the server automatically unlocks the war package and creates a folder with the same name in this directory. A war package is an attribute format jar package, It is to compress all the contents of a web program. Specifically how to package, you can use many development tools of the ide environment, such as eclipse and so on. You can also use   cmd command: JAR-CVF mywar.war  myweb      webapps This default app directory can also be changed. Open conf in server.xml file, find the following:

Unpackwars= "true" autodeploy= "true"

Xmlvalidation= "false" Xmlnamespaceaware= "false" >

appbase modify. 2, specified in Server.xml     tomcat configuration file, a web application is a specific context, can be passed in context Deploy a jsp application. Open server.xml file, context, the contents are as follows.

In the conf directory in Tomcat, in server.xml,add: <context path= "/hello" in the = "D:\ workspace\hello\webroot" Debug= "0" Privileged= "true" > </context>

Or

<context Path= "/myapp" reloadable= "true" docBase= "D:\myapp" workdir= "D:\myapp\ Work "/>

Or

<context Path= "/sms4" docBase= "D:\workspace\sms4\WebRoot"/>

Description

Path is a virtual path;

DocBase is the physical path of the application;

Workdir is the working directory of the application that stores the files generated by the runtime associated with this application;

Debug is set to debug level, 0 means to provide the least information,9 to provide the most information

Privileged is set to true to allow Tomcat Web apps to use the Servlet within the container

reloadable if true, Tomcat automatically detects changes in the application's /web-inf/lib and /web-inf/classes directories, automatically mounts new applications, and can not restart the case of Tomcat changes the application to implement a hot deployment

AntiresourcelockingAndAntijarlockingThermal deployment is a parameter that needs to be configured, and the defaultFalseAvoid updating aWebApp, sometimes.Tomcat does not take the oldWebApp is completely deleted, usually leavingA web-inf/lib under theJar package, must be closedTomcat can be deleted, which results in automatic deployment failure. Set toTrueTomcatWhen running the correspondingwebappjar The file is copied to a temporary directory. 3, create a context file   conf directory, the new Catalina\xml file, the name can not be arbitrarily taken, and path after the name of the same, according to the bottom of this path configuration, xml should be named hello ( Span style= "Font-family:times New Roman;" >hello.xml), the xml file are:

<context path= "/hello" docbase= "E:\workspace\hello\WebRoot" debug= "0" privileged= "true" ></Context>

Examples of Tomcat comes in as follows:

<context docbase= "${catalina.home}/server/webapps/host-manager"

Privileged= "true" antiresourcelocking= "false" antijarlocking= "false" >

</Context>

This example is Tomcat's own, and the edited content is actually the same as the second, where the XML file name is the access path, which hides the app's real name.

4. Note:

Deleting a web app also deletes the corresponding context in the corresponding folder and Server.xml under WebApps, and also the Tomcat conf\catalina\ The corresponding XML file is deleted under the localhost directory , otherwise Tomcat will still go to configure and load ...

Two dynamic deployments

Login to the Tomcat Management console:http://localhost:8080/, enter your username and password to manage your app and publish it dynamically.

context Path (option): Enter /yourwebname, which represents the access address of your app.

     XML configration file In the URL you want to specify a xml files, such as our f : \ Set up a hmcx.xml file with the following contents:   <context reloadable= "false"/> where docbase is not required to write because it is filled in the next text box. Or more simply, this text box does not fill anything, in war or Directory URL: type F:\HMCX, then click deploy button, you can see the web application, name context Path (option): the name in.

If there is a simpler way to deploy the. War file, here's a Select War file uploae Click Browse to select the . war files, and then click Deploy.

Reproduced in: http://blog.csdn.net/diamondy/article/details/7472411

How Tomcat projects are deployed

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: info-contact@alibabacloud.com 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.