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

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

问题描述

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



问题:有没有办法在tomcat中执行部署订单?



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



嗯,其实这个人建议将webapps的名称更改为字母顺序将有所帮助。但是,我不愿意这样做,每次我需要测试这些和不同的战争。



我很乐意有一种方法来配置其中一个tomcat conf .xml文件。我只是不知道哪一个。

解决方案

从Tomcat Wiki - webapps启动什么顺序(或如何更改启动顺序)?



< blockquote>

没有预期的启动顺序。 Servlet规范和
Tomcat都没有定义一个。您不能依赖以任何
特定订单开始的应用程序。


Tomcat具有从不支持指定webapps的加载顺序。还有其他容器,如 JBoss ,但是Tomcat从来没有。任何看起来像通过网络应用程序名称的字母顺序加载排序的行为是巧合的,并不能保证在所有情况下都可以工作。



你可能在想什么of是$ < load-on-startup /> 元素,如果 web.xml 指定加载顺序 servlets



表示使用服务发现协议的优雅解决方案。



一个解决方案是使用 ZeroConf 等功能,并在启动时注册您的服务,然后让这些依赖应用程序查找这些服务是否可用,并让它们连接,并在服务准备就绪时执行他们需要做什么。这就是我多年来一直处理多个依赖服务的方式。我有Python,Java和Erlang服务,都通过ZeroConf发现对方。


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...

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

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

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.

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.

解决方案

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

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 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.

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.

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天全站免登陆