有没有办法在 tomcat6 中强制执行部署顺序? [英] Is there a way to enforce a deployment order in tomcat6?

查看:26
本文介绍了有没有办法在 tomcat6 中强制执行部署顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 webapp 文件夹中有 3 个战争.其中两个建立在第三个服务的基础上.我在测试环境中,即我无法控制他们的架构,所以我无法改变任何事情.所以...

I have 3 wars in my webapp folder. Two of them are built on services of the third one. I'm in a testing environment, i.e. I don't have control over their architectures, so I'm no able to change a thing. So...

问题:有没有办法在 tomcat 中强制执行部署顺序?

Question: Is there a way to enforce a deployment order in tomcat?

我在这里遇到了一个问题 在 stackoverflow 中,但没有解决方案.

I've ran into one question here in stackoverflow, but there's no solution.

嗯,实际上这家伙建议将 Web 应用程序的名称更改为按字母顺序排列会有所帮助.但是,每次我需要测试这些和不同的战争时,我都不愿意这样做.

Well, actually the guy suggests that changing the name of the webapps to an alphabetical order would help. However, I'm not willing to do that everytime I need to test those and different wars.

我确信有一种方法可以配置其中一个 tomcat conf .xml 文件.我只是不知道是哪一个.

I'm positive that there's a way of doing that configuring one of the tomcat conf .xml files. I just don't know which one.

推荐答案

来自 Tomcat Wiki - webapps 的启动顺序是什么(或者如何更改启动顺序)?

From the Tomcat Wiki - What order do webapps start (or How can I change startup order)?

没有预期的启动顺序.既不是 Servlet 规范也不是Tomcat 定义了一个.您不能依赖以任何开头的应用程序特定顺序.

There is no expected startup order. Neither the Servlet spec nor Tomcat define one. You can't rely on the apps starting in any particular order.

Tomcat 从不支持指定 web 应用程序的加载顺序.还有其他容器,例如 JBoss,但 Tomcat 从来没有.任何看起来像通过网络应用名称的字母顺序进行加载排序的明显行为纯属巧合,不能保证在所有情况下都能正常工作.

Tomcat has never supported specifying load order of webapps. There are other containers like JBoss that do, but Tomcat never has. Any apparent behavior that looks like load ordering via the alphabetical order of the names of the web apps is coincidental and not guaranteed to work in all cases.

您可能想到的是 <load-on-startup/> 元素,如果 web.xml 指定加载 servlet 的顺序.

What you are probably thinking of is the <load-on-startup/> element if the web.xml that specifies order of loading servlets.

也就是说,有一个使用服务发现协议的优雅解决方案.

That said there is an elegant solution using a service discovery protocol.

一种解决方案是使用诸如 ZeroConf 之类的东西,并在它们启动时注册您的服务,然后让依赖的应用程序会寻找这些服务何时可用,并让它们连接并在服务准备好时执行它们需要做的任何事情.这就是我多年来处理多个依赖服务的方式.我有 Python、Java 和 Erlang 服务,它们都通过 ZeroConf 无缝地发现彼此.

One solution is to use something like ZeroConf and register your services when they start up, and then have the dependent apps look for when these services come available and have them connect and do what ever they need to do when the service is ready. This is how I have been handling multiple dependent services for years now. I have Python, Java and Erlang services all discovering each other via ZeroConf seemlessly.

这篇关于有没有办法在 tomcat6 中强制执行部署顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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