gpt4 book ai didi

java - CATALINA_HOME 路径设置

转载 作者:行者123 更新时间:2023-11-28 22:32:00 24 4
gpt4 key购买 nike

在安装Tomcat的时候,很多论坛都说需要设置CATALINA_HOME变量,指向Tomcat的父目录。我正在通过 eclipse 运行 web 项目,它在存在和不存在此环境变量设置的情况下运行。

我想知道这个变量解决的确切目的是什么,什么时候设置它成为强制性的。

我还想知道驻留在 Tomcat/bin 目录中的 tomcat-juli.jar 的确切用途

最佳答案

Q>这个变量解决的具体目的是什么
A> Javadoc Bootstrap 类说:

This application constructs a class loader for use in loading the Catalina internal classes (by accumulating all of the JAR files found in the "server" directory under "catalina.home"), and starts the regular execution of the container. The purpose of this roundabout approach is to keep the Catalina internal classes (and any other classes they depend on, such as an XML parser) out of the system class path and therefore not visible to application level classes.

但还有更多。 CATALINA_HOME 和(可互换)CATALINA_BASE 定义了一个“基目录”,用于引用work 目录(用于保存已编译的 jsps ), 也有助于查找上下文配置文件等。

可能是 Eclipse 在您不知情的情况下设置了这些属性。全部打印system properties看看里面有什么。

Q>什么时候设置成为强制性的
A> 据我所知

问>tomcat-juli.jar的具体使用
A> 直接来自 Tomcat documentation :

Apache Tomcat has its own implementation of several key elements of java.util.logging API. This implementation is called "JULI". The key component there is a custom LogManager implementation, that is aware of different web applications running on Tomcat (and their different class loaders). It supports private per-application logging configurations. It is also notified by Tomcat when a web application is unloaded from memory, so that the references to its classes can be cleared, preventing memory leaks.

关于java - CATALINA_HOME 路径设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12491016/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com