如何更新Tomcat webapp而不重新启动整个服务? [英] How do I update a Tomcat webapp without restarting the entire service?

查看:1949
本文介绍了如何更新Tomcat webapp而不重新启动整个服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的 Tomcat 。我们有一个开发机器,大约有5个应用程序运行。即使它是开发人员,它在测试期间被我们的客户大量使用。

I'm new to Tomcat. We have a dev machine with about 5 apps running. Even though it's dev, it's used by our clients pretty heavily during testing.

所以说我们需要对一个类文件进行一个小的更改。现在,我们必须关闭Tomcat(影响其他四个应用程序),删除 WAR 文件(和Web应用程序目录),重新部署新的 WAR 文件并重新启动 Tomcat

So say we need to make one small change on one class file. Right now, we have to shutdown Tomcat (affecting the other four apps), delete the WAR file (and web app directory), redeploy the new WAR file and restart Tomcat.

当然,这会扰乱几个人,因为它破坏所有应用程序的所有登录会话。

Of course, this upsets a few people because it destroys all logged in sessions for all apps.

有更好的方法吗?我的意思是说,有没有办法只重新加载改变开发机器上的所有东西的 CLASS

Is there a better way to do this? I mean, is there a way to only reload the CLASS that changed instead of everything on the dev machine?

谢谢。

推荐答案

您是否尝试使用 Tomcat的Manager应用程序?它允许您通过关闭Tomcat来取消部署/部署war文件。

Have you tried to use Tomcat's Manager application? It allows you to undeploy / deploy war files with out shutting Tomcat down.

如果不想使用Manager应用程序,还可以从webapps目录,Tomcat将在短时间内取消部署应用程序。然后,您可以将war文件复制回目录,Tomcat将部署war文件。

If you don't want to use the Manager application, you can also delete the war file from the webapps directory, Tomcat will undeploy the application after a short period of time. You can then copy a war file back into the directory, and Tomcat will deploy the war file.

如果您在Windows上运行Tomcat,则可能需要配置您的上下文以不锁定各种文件。

If you are running Tomcat on Windows, you may need to configure your Context to not lock various files.

如果绝对不能有任何停机时间,您可以想查看 Tomcat 7的并行部署您可以部署多个版本的Web应用程序同时具有相同的上下文路径。用于将请求与上下文版本匹配的规则如下:

If you absolutely can't have any downtime, you may want to look at Tomcat 7's Parallel deployments You may deploy multiple versions of a web application with the same context path at the same time. The rules used to match requests to a context version are as follows:


  • 如果请求中没有会话信息,请使用最新版本

  • 如果请求中存在会话信息,请检查每个版本的会话管理器是否有匹配的会话,如果找到,则使用该版本。

  • 如果请求中存在会话信息,但找不到匹配的会话,请使用最新版本。

这篇关于如何更新Tomcat webapp而不重新启动整个服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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