我已经通过context.xml设置了一个Jetty上下文来使用虚拟主机 . 所以我的目录结构如下所示:
webapps
--mycontext.xml
--mycontext.war
现在,当我上传新战争时,不再进行热部署 . 它只发生在我修改mycontext.xml时 . 当我没有mycontext.xml工作时,情况并非如此 .
这是mycontext.xml的内容
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/</Set>
<Set name="war"><Property name="jetty.webapps" default="."/>/mycontext.war</Set>
<Set name="virtualHosts">
<Array type="String">
<Item>example.com</Item>
<Item>www.example.com</Item>
<Item>localhost</Item>
<Item>127.0.0.1</Item>
</Array>
</Set>
</Configure>
有关如何通过更新war文件重新获得热部署的任何想法?
1 回答
您需要将mycontext.xml放在服务器的contexts目录中 . 此外,您可能需要在etc / jetty-deploy.xml中为webapps目录中的war文件启用热部署,如here所述 . 如您所见,配置启用了热部署
以下是适合我的配置
jetty.home / contextx / mycontext.xml
请注意我是如何提供war文件名和位置的
jetty.home的/ etc /码头-deploy.xml
通过这种配置,当我在webapps中放置修改后的mycontext.war时,jetty很乐意重新部署战争 .