gpt4 book ai didi

java - Tomcat没有自动部署war文件

转载 作者:IT老高 更新时间:2023-10-28 21:05:54 25 4
gpt4 key购买 nike

我按照以下步骤操作

  • 关闭 Tomcat
  • 部署了一个时间戳为 12 月 1 日的 war 文件
  • 启动 Tomcat - 这为已部署的 war 文件创建了展开的目录。
  • 停止 Tomcat
  • 使用时间戳为 12 月 3 日的新文件更新了 war 文件
  • 重启Tomcat

我发现当我重新启动Tomcat时,之前扩展的文件夹中的现有文件没有更新。对war文件的更新不应该更新了相关的jsp、class文件吗?

我查看了文档并找到了 http://tomcat.apache.org/tomcat-5.5-doc/config/host.html . “自动应用程序部署”下的以下引用

In addition to the automatic deployment that occurs at startup time, you can also request that new XML configuration files, WAR files, or subdirectories that are dropped in to the appBase (or
$CATALINA_HOME/conf/[engine_name]/[host_name] in the case of an XML configuration file) directory while Tomcat is running will be automatically deployed, according to the rules described above. The auto deployer will also track web applications for the following changes:

  • An update to the WEB-INF/web.xml file will trigger a reload of the web application
  • An update to a WAR which has been expanded will trigger an undeploy (with a removal of the expanded webapp), followed by a deployment
  • An update to a XML configuration file will trigger an undeploy (without the removal of any expanded directory), followed by a deployment of the associated web application

是否应该根据上述第 2 点自动更新文件?

在 server.xml 中将 Autodeploy 设置为 true

最佳答案

从历史上看,当你放入一个新的 jar 时,tomcat 从来没有更新过分解的目录,至少对我来说是这样。我一直认为这是一个错误,但从未调查过它,因为有一个简单的解决方案。这两个都应该可以正常工作:

  • 使用内置的 Manager 应用程序部署 war 文件。如果您可以使用 GUI 进行生产管理,那很好。 注意如果您多次部署此工具会出现问题(同样,我从未深入研究过细节),但 Tomcat 重启工作正常。
  • 停止、删除和删除。停止Tomcat,删除分解后的目录,放入新的war文件。
  • 关于java - Tomcat没有自动部署war文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4604335/

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