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

What is the operation mode of Tomcat in Linux

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail about the operation of Tomcat in Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Startup and shutdown of Tomcat under Linux

On Linux systems, start and shut down Tomcat using command operations.

Enter the bin directory under Tomcat

Cd / java/tomcat/bin

Start the Tomcat command

. / startup.sh

Stop Tomcat service command

. / shutdown.sh

After executing tomcat. / shutdown.sh, although the tomcat service cannot be accessed normally, after ps-ef | grep tomcat, it is found that the java process corresponding to tomcat is not destroyed as the web container is closed, so there is a zombie java process. The reason for the zombie process on the Internet may be that there are non-daemon threads (that is, User Thread) and jvm will not exit (when all threads in JVM are daemon threads, JVM can exit; if there are one or more non-daemon threads, JVM will not quit). Check whether the Tomcat process ends with the following command:

Ps-ef | grep tomcat

If a similar message is displayed, the Tomcat process has not ended

Gateway 14705 14703 12 08:29 pts/0 00:03:10 / www/websoft/java/java1/jdk1.7.0_25/jre/bin/java-Djava.util.logging.config.file=/www/websoft/tomcat1/conf/logging.properties-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-server-Xms1536m-Xmx1536m-Xss256k-XX:MaxPermSize=512m-XX:+UseParallelGC-XX:ParallelGCThreads=20-XX:+UseParallelOldGC-XX:MaxGCPauseMillis=100-XX:+UseAdaptiveSizePolicy-Djava.endorsed.dirs=/endorsed-classpath / www/websoft/ Tomcat1/bin/bootstrap.jar:/www/websoft/tomcat1/bin/tomcat-juli.jar-Dcatalina.base=/www/websoft/tomcat1-Dcatalina.home=/www/websoft/tomcat1-Djava.io.tmpdir=/www/websoft/tomcat1/temp org.apache.catalina.startup.Bootstrap start

At this point we can force the end of the process (zombie process)

Kill-9 14705

After the execution of the previous command, re-check the Tomcat process, and Tomcat has stopped completely.

Several Operation modes of Tomcat on Linux

Startup, shutdown and error tracking of tomcat service under Linux. After remote connection to the server using PuTTy, the tomcat service is usually started and shut down in the following ways:

Start the tomcat service

Method 1:

Directly start. / startup.sh

Method 2:

Start nohup. / startup.sh & as a service

Method 3:

The console dynamic output mode starts. / catalina.sh run dynamically displays the console output information of the tomcat background, and then exits and shuts down the service after Ctrl+C

Explanation:

Tomcat started through mode 1 and mode 3 has a drawback: when the client connection is disconnected, the tomcat service will stop immediately; through mode 2, it can always run as a linux service.

The log of the tomcat started by mode 1 and mode 2 will be written to the corresponding log file, but the output information and errors of the tomcat console cannot be viewed dynamically.

Through the third way, you can start the tomcat service in console mode and directly see the console output information of the background when the program is running. You don't have to open the catalina.out log file to view it every time, so it is easy to track and check the background output information. The tomcat console information includes output information such as log4j and System.out.println ().

This is the end of this article on "how Tomcat works in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Servers

Wechat

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

12
Report