Preface Tomcat is an excellent Java container, but there are still some small pitfalls that cannot be avoided. I will record them here. START question
Scenario Description 1. There are two projects under webapps, projectA and projectB. Except for the management information interface, the other two projects have security verification mechanisms. 2. Since projectA is not separated from the front-end and back-end, the static resources also exist in the Java project. When making interface requests in static resources, the package name is not written. For example, when logging in, the js code will concatenate the server ip+port+currently set url (/login), but not add /projectA before /login. Therefore, there is no problem in testing on the local machine, and such a problem will only occur when deploying. This is also a problem, which will be solved below. 3.projectB is a normal running project Solution for scenario 2 Open the configuration file in tomcat, add <Context> in the <Host> tag to set it as the default access path of the server, so as to avoid the package name, but this method is extremely informal and is not recommended. <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> <Context path="" docBase="/usr/tomcat8.6/webapps/sc_edu" debug="0" reloadable="true"/> </Host> Code Explanation <Context path="" docBase="/usr/tomcat8.6/webapps/sc_edu" debug="0" reloadable="true"/>
Then our solution is to install another tomcat and only deploy projects that require direct path mapping This will return to the directory where tomcat is located, and the cp command will copy $> cp -r tomcat8.5/ tomcat8.6/ Then move projectA in tomcat8.5 to tomcat8.6. Delete the tomcat8.5 <Context path="" docBase="/usr/tomcat8.6/webapps/sc_edu" debug="0" reloadable="true"/> In tomcat8.6, the following changes need to be made to service.xml. Change the port corresponding to shutdown to 8006, as long as it is different from tomcat8.5 and the port does not conflict. <Server port="8006" shutdown="SHUTDOWN"> Change the port corresponding to the request, the principle is the same as above <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> The content in the <Host> tag is copied and needs to be modified to the corresponding mapping path. In this way, two tomcats can run at the same time, and startup and shutdown do not affect each other. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: MySQL 5.7.18 download and installation process detailed instructions
today select * from table name where to_days(time...
Table of contents Introduction Child Process Crea...
Table of contents The role of cloneElement Usage ...
As we all know, without the cd command, we cannot...
Table of contents 1. Vue life cycle 2. Hook funct...
Table of contents What is a slot Understanding of...
1. MYSQL installation directory Copy the code as ...
I started learning MySQL recently. The installati...
Preface: In the previous article, we mainly intro...
Table of contents Preface The difference between ...
1. Overflow Overflow is overflow (container). Whe...
Copy code The code is as follows: <!DOCTYPE ht...
1. What is event delegation? Event delegation: Ut...
Table of contents 1. Location Object 1. URL 2. Pr...
background The amount of new data in the business...