tomcat manages multiple projects and shares jar packages

       When tomcat deploys multiple applications at the same time, if these applications have common jar packages, you can extract these jar packages and put them into tomcat for management. The specific methods are as follows:

       The first method: Put the jar package that needs to be shared under the lib of the tomcat installation directory. Here, a new shared folder is used, and then the common.loader property in is modified. Add ",${catalina.home}/lib/shared/*.jar" to the original value of the common.loader property, and then start tomcat. Obviously, you need to put the shared jar package in a shared directory, and then put the shared directory in the lib directory under tomcat.

       The second method: Create a new directory under the tomcat installation directory to store the public jar package. Here, create a new shared folder and create a new lib directory, and modify the shared.loader property in Set the shared.loader property value to ${catalina.base}/shared/lib, ${catalina.base}/shared/lib/*.jar, and then start tomcat. It is also necessary to put the shared jar package under the lib of the shared directory, but this time the shared directory is placed under the tomcat installation directory.

       The shared jar package is not necessarily placed according to the above two directory structures, it can be placed in any directory, and the absolute path can be used for reference when referencing.

       In this way, there may be a problem with the sharing of jar packages. The extracted jar packages may not be independent, and may be referenced to other jar packages. In this case, the associated jar packages need to be extracted together. , otherwise an error will be reported when starting tomcat, which is very important.

Guess you like