Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A tutorial on using Tomcat

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "the use of Tomcat tutorial", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the tutorial on the use of Tomcat.

Tomcat download

Tomcat official website: http://tomcat.apache.org

Installation

Just unpack the downloaded tomcat package directly.

* Note: it is not recommended to install it in a blank or Chinese directory.

Unloading

You can delete the extracted file directly.

Directory parsing (general structure of apache open source projects)

Bin executable file

Conf profile

Lib depends on the jar package

Logs log file

Temp temporary file

Webapps web project storage

Wrok stores runtime data

Start

Find the bin file, starup is the startup file, double-click the bat file under Windows to start; run sh under Linux to start

So let's enter the default website in the browser: localhost:8080 or 127.0.0.1 8080

See the following page to show that tomcat started successfully

When others visit our computer: http//ip address: Port number

* Note:

The black window flashed by when it started.

Reason: this is because the environment variable java_home is not configured correctly, and tomcat cannot find the environment variable java_home

Solution: configure java_home correctly

Start the error report, we can find the log file of Katerina under logs.

Reason: the port may be occupied

Solution: 1. Close the occupied port, 2. Use a different port

Close

There are two ways to close it.

Force shutdown, directly close the tomcat startup window

Close normally: locate bin/shutdown.bat. Use the shutdown command; or ctrl+c

Configuration

Just put the project under the webapps directory.

Localhost:8080/hello: project access path, which is a virtual directory

Simplify deployment: package the project into a war package, and then place the war package in the webapps directory. The war package here will be decompressed automatically.

two。 Configure the conf/server.xml file

Configure in the tag body:

DocBase: project storage path, path: virtual directory

3. Create a xml file with any name in conf\ Catalina\ localhost and edit it in the file

We find that it is similar to the second way, except that without the path, then the virtual directory is the name of the xml file.

Java dynamic and static projects

Java dynamic projects:

-- Project name

-- WEB-INF

-- web.xml: the core configuration file of the project

-- classes: place bytecode files

-- lib: places the jar package that the project depends on

At this point, I believe you have a deeper understanding of the "tutorial on the use of Tomcat". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report