tomcat 热部署(自动部署)

关于tomcat的自动部署,网上很多人转帖都是用了下面的方法:

在Tomcat安装目录下,找到conf文件下的server.xml,在<Host>和</host>之间加上如下代码:

<Context path="/虚拟目录名" docBase="目标目录位置" debug="0" reloadable="true" ></Context>

但我用这种方式却出错,无奈直接看tomcat的文档。

 

One or more Host elements are nested inside an Engine element. Inside the Host element, you can nest Context elements for the web applications associated with this virtual host

上面的方法应该就是按照这种方式将context嵌入到了host节点中。于是去看Context的配置

Context中有这样一个属性:reloadable

reloadable

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. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.

这个属性可以在我们编译的class文件和库文件发生改变时,自动重新部署web项目,这个功能在开发时很有用但需要很大的运行开销,所以不建议在已经部署的项目上使用。但我的服务器主要是为了开发用,所以直接在Tomcat安装目录下,找到conf文件下的context.xml,修改<Context><Context reloadable="true">

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值