In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to implement a Windows service in Tomcat, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Method 1:
We can directly download the installation version of Windows, the exe file, and the Windows service will be installed during installation.
Method 2:
Download the decompressed version of the corresponding CPU structure, and the file downloaded to the bin directory will contain three such files. Let's take Tomcat6 as an example:
Compared with the general decompressed version, there are three more files in the red box above.
When installing the service, you only need to execute the following command on the command line:
Service.bat install
After that, the service items of Apache Tomcat 6 will be added to the list of services for the service Windows, and operations such as start and stop can be carried out like other services.
Method 3:
If you have made a specific configuration in some scripts and want to install as a service at this time, you can find a Tomcat that contains three files in method 2, copy these three files, execute the above installation commands, or complete the task installation.
Method 4:
Realize the registration and de-registration of the service mode through the C++/C#.
In essence, mode 2 and 3 are the same, we analyze the principle of Tomcat service installation and implementation from these three files.
First of all, let's take a look at the main contents of service.bat:
Executable:
Install command parameters:
We notice that in executable, you execute tomcat6.exe, the application, which is essentially a Wrapper.
Windows services need to communicate with services in the form of signals or messages through the service manager. There is no specific implementation in Windows JVM, so JVM is not good at running as Windows services.
Therefore, in order to realize that JAVA applications run as Windows services, a common way is in the form of Wrapper, so that the messages in the service manager can be delivered to JVM, so that the application can act accordingly.
Apache's procrun project is one such project that provides Wrapper. The project can be learned here: http://commons.apache.org/daemon/procrun.html.
Tomcat6.exe is the prunsrv in the procrun project. After we install the service, we are actually operating the exe. You can check the properties of the service to learn:
We see that the path to the executable file is to execute the tomcat6.exe. At the same time, a parameter is passed in at the end of the application.
What does this parameter mean? Let's take a look at the following instructions:
Among them, RS represents starting through the service manager. A special one included in the command is MS, or Monitor Start, which minimizes the application to the system tray (Tray) after startup.
I've been talking about tomcat6.exe for a long time, so what is tomcat6w.exe?
We double-click to execute, and we can see this picture.
The above is how to implement a Windows service in Tomcat. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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: 210
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.