Home >Operation and Maintenance >Linux Operation and Maintenance >Introduction to the working principle of catalina.bat in Tomcat

Introduction to the working principle of catalina.bat in Tomcat

巴扎黑
巴扎黑Original
2017-09-08 10:17:121561browse

This article mainly gives you a detailed introduction to the principles of catalina.bat in Tomcat. The article introduces it in great detail through sample code. It has certain reference learning value for everyone's study or work. Friends who need it can refer to it. , let’s learn with the editor below.

Preface

This article mainly provides you with a detailed analysis of the relevant content about the catalina.bat principle in Tomcat, and shares it for your reference and study. Not much to say below, let’s take a look at the detailed introduction.

The actual startup of tomcat is set and started in catalina.bat. startup.bat just finds catalina.bat and executes catalina.bat to start tomat. Let's analyze catalina.bat

Verify the CATALINA_HOME environment variable

  • Verify that the CATALINA_HOME setting is correct. If not, reset the CATALINA_HOME environment variable.

  • If catalina.bat is not found in the CATALINA_HOME\bin directory, it will end (this situation will basically not happen here unless catalina.bat is not in tomcat's bin directory )

Set environment variables


## 1. In CATALINA_BASE Search the setenv.bat file in the and CATALINA_BASE directories and execute it. If it is not found, it will not be executed.


2. Find the setclasspath.bat file and execute it. If it is not found, end it.

setclasspath.bat Sets java-related environment variables.

tomcat log management

Add tomcat-juli.jar to the classPath environment variable.

And add the log configuration file path to the LOGGING_CONFIG environment variable

tomcat-juli.jar Function

Apache Tomcat is implemented by its own java.util .Document the implementation of multiple key elements. This implementation is called JULI. The core component of the implementation is a customized LogManager, which can obtain different web applications (and different class loaders) running in Tomcat. It supports configuring individual log configurations for applications. When a web application is uninstalled from within, it will be notified by Tomcat so that the classes it refers to can be cleared to avoid memory leaks.

Console information output

The output is as follows:


Introduction to the working principle of catalina.bat in Tomcat

Set tomcat startup class

Set tomcat remote debugging Relevant parameters

Introduction to the working principle of catalina.bat in Tomcat

After turning on the remote debugging function, configure the Host and Port in eclipse and then Debug can remotely debug the program in tomcat.

Introduction to the working principle of catalina.bat in Tomcat

Other startup modes

In addition to the remote debugging startup mode, there are also the following startup modes


It can be seen from this that catalina.bat is called when starting tomcat and closing tomcat.

The difference between run and start is whether to start tomcat in a new window.


run is executed in this window.


start is to open a new window for execution.

The above is the detailed content of Introduction to the working principle of catalina.bat in Tomcat. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn