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

查看:44
本文介绍了如何在不重新启动整个服务的情况下更新 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 的管理器应用程序?它允许您在不关闭 Tomcat 的情况下取消部署/部署战争文件.

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

如果不想使用Manager应用,也可以把webapps目录下的war文件删除,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天全站免登陆