In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
What the editor wants to share with you this time is how to deploy multiple war packages in Tomcat. The article is rich in content. Interested friends can learn about it. I hope you can get something after reading this article.
1 background
Install JDK1.8-u181 (actually installing JRE is enough, but I have an installation package for JDK, why download it again) and Tomcat8.5.53.
After installation, JAVA_HOME,Path is configured in the environment variables. It comes with JRE, not with JDK.
Two war packages, MES and ERP, will be released.
2 install Tomcat
I installed it with a .exe file without tomvat_home after installation (because I don't know if I need to configure it)
3 copy folder
3.1 installation directory confCatalina
Catalina is a folder that makes two copies of Catalina, one named CatalinaMES and the other named CatalinaERP, both in the installation directory\ conf directory
3.2installation directory webapps
Webapps is also a folder. Make two copies, one named webappsMES and the other named webappsERP, both in the installation directory.
The war package for the MES project is placed in the installation directory\ webappsMES
The war package for the ERP project is placed in the installation directory\ webappsERP
4 modify the configuration file
Modify the contents of the installation directory\ conf\ server.xml
Where a node represents a service, that is, a deployed project.
The name property of the node is changed to the name of the corresponding Catalina folder. The name attribute of the node is also changed to the name of the corresponding Catalina folder.
The port attribute of the node is the port number of the project, so just be careful not to conflict.
The appBase property of the node is changed to the corresponding webapps folder.
The path attribute of the node is the address at the time of access, that is, the access address of the project is the value of the server ip: project port number / path attribute. According to the current configuration, the native access address of my MES project is 127.0.0.1:8085/mes-manager-web. The docBase attribute of the node is the local path of the project war package, as long as it is changed to the absolute path of the war package on the local machine.
5 modify startup.bat and shutdown.bat
Edit the installation directory\ bin\ startup.bat and add:
SET JAVA_HOME=C:\ Program Files\ Java\ jre1.8.0_181SET TOMCAT_HOME=C:\ Program Files\ Tomcat 8.5
The first is the installation location of JRE, and the second is the installation path of tomcat.
Add the same content in the same place in shutdown.bat.
6 double-click startup.bat to run tomcat
Note that a dos window will open, which will print the startup information of the project like the console of IDEA. When the project starts successfully, do not close the dos window, keep it open. If you turn off tomcat, it will stop running.
7 points for attention
If multiple projects use the spring framework, an error may be reported when configured as a tomcat multi-port multi-application.
Solution: add the following nodes to the web.xml of each project:
WebAppRootKeywebapp.root
Make sure that the web.xml of each project corresponds to a different webAppRootKey. For example, the first one uses webapp.root1, the second uses webapp.root2, and so on.
In addition, pay attention to whether the server's firewall allows external access to the port you want to configure.
After reading this article about how Tomcat deploys multiple war packages, if you think the article is well written, you can share it with more people.
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.
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.