让Tomcat重新加载具有静态上下文的Web应用程序 [英] Getting Tomcat to reload a web app with a static context

查看:174
本文介绍了让Tomcat重新加载具有静态上下文的Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主机,它不会自动部署所有网络应用。

I have a Host that doesn't automatically deploy all web apps.

  <Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="false"
        xmlValidation="false" xmlNamespaceAware="false">

但我确实希望 dreambear 网络应用无需重启即可自动重新加载,用于开发目的(因此这是在SO上,而不是服务器故障)。

But I do want the dreambear web app to automatically reload without a restart, for development purposes (hence this is on SO, not Server Fault).

Catalina / localhost / dreambear.xml

<Context reloadable="true">
    <Parameter name="gamePageUrl" value="http://****/dreambear.html" />
</Context>

我通过将dreambear.war放入webapps目录来部署Web应用程序。不幸的是,它不会自动重新加载:

I deploy the web app by putting dreambear.war in the webapps dir. Unfortunately, it doesn't automatically get reloaded:


  • (主机:unpackWARs = false):未检测到新版本的WAR

  • (主机:unpackWARs = true):新版本的WAR未解包

  • (主机:unpackWARs = true):如果我删除了解压后的目录,新的WAR将被解压缩但未部署。

有没有办法实现我想要的?我不想启用 autoDeploy ,因为每次我放入一个新WAR时都会删除我的上下文xml(见这里)。

Is there a way to achieve what I want? I don't want to enabled autoDeploy because my context xml will be deleted every time I put in a new WAR (see here).

推荐答案

我尝试了一些组合,没有一个会从WAR文件重新部署, autoDeploy 设置为 false

I've tried some combinations, and none of them will redeploy from the WAR file with autoDeploy set to false.

reloadable 设置为 true 上下文无法正常工作,因为文档状态

Setting reloadable to true in Context wont work, since the docs state


如果你希望Catalina在/ WEB-INF / classes /
和/ WEB-INF / lib中进行
监视类的更改,则设置为true,
自动重新加载web
应用程序,如果检测到更改。

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected.

我也尝试从经理网络应用程序重新加载

I've also tried reloading from the manager web app

http://localhost:8080/manager/reload?path=/dreambear

但是,也不会对战争进行更改


当web
应用程序上下文无法重新加载$ ​​b $ b并且您在/ WEB-INF / classes $ b $中更新了类或
属性文件时,这非常有用b目录或在/ WEB-INF / lib
目录中添加或
更新的jar文件。

This can be useful when the web application context is not reloadable and you have updated classes or property files in the /WEB-INF/classes directory or when you have added or updated jar files in the /WEB-INF/lib directory.

经理文档对此更加清晰


目前,不支持重新加载应用程序(
获取类更改或
web.xml文件)当一个
Web应用程序直接从WAR文件部署
时。它只适用于从
一个解压缩目录部署Web应用程序的
。如果您使用WAR文件是
,则应取消部署
,然后再使用
update参数部署或部署应用程序
以获取更改。

Currently, application reloading (to pick up changes to the classes or web.xml file) is not supported when a web application is deployed directly from a WAR file. It only works when the web application is deployed from an unpacked directory. If you are using a WAR file, you should undeploy and then deploy or deploy with the update parameter the application again to pick up your changes.

这篇关于让Tomcat重新加载具有静态上下文的Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆