gpt4 book ai didi

java - tomcat 6如何选择部署WAR文件的顺序

转载 作者:行者123 更新时间:2023-11-28 22:42:53 28 4
gpt4 key购买 nike

我有一套部署为多个 WAR 文件的 Web 应用程序。我已将此代码部署到多个虚拟机并且运行良好。我的 devops 团队创建了一个新的 VM,它基本上是其他 VM 的副本,其中一个 Web 应用程序在启动时抛出异常。错误如下所示。在比较环境时,我注意到有错误的 VM 以与其他服务器不同的顺序部署应用程序。我认为那里可能有一些东西。我如何强制 tomcat 按指定顺序部署 web 应用程序,这恰好是其他 VM 上的字母顺序?

只是为了进一步启发,我们使用 Jenkins 来构建和部署代码,所以我 100% 确定相同的代码和库在几乎重复的 Linux/Tomcat 环境中运行良好。

Feb 27, 2014 8:33:03 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 395 ms
Feb 27, 2014 8:33:03 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 27, 2014 8:33:03 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.37
Feb 27, 2014 8:33:03 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive appmgmt20.war
Feb 27, 2014 8:33:05 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive ROOT.war
Feb 27, 2014 8:33:06 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive appmgmt10.war
Feb 27, 2014 8:33:07 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive lbprobe.war
Feb 27, 2014 8:33:07 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive travel.war
2014-02-27 08:33:08 ERROR ContextLoader:227 - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from ServletContext resource [/WEB-INF/classes/edu/cornell/finsys/webservices.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [oracle.xml.jaxp.JXDocumentBuilderFactory@10987197] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at
....
Feb 27, 2014 8:33:08 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Feb 27, 2014 8:33:08 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/travel] startup failed due to previous errors
Feb 27, 2014 8:33:08 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive cashreceipts.war
Feb 27, 2014 8:33:09 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive jems.war
Feb 27, 2014 8:33:09 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive paymentrequest.war
Feb 27, 2014 8:33:09 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive acctmgmt.war
Feb 27, 2014 8:33:09 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive appmgmtbulkldr.war
Feb 27, 2014 8:33:10 AM org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
Feb 27, 2014 8:33:10 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on localhost/127.0.0.1:8108
Feb 27, 2014 8:33:10 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/65 config=null
Feb 27, 2014 8:33:10 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6897 ms

最佳答案

不幸的是,没有这样的东西,因为 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.

无论如何,通过在您的 server.xml 文件中指定部署顺序,有一个潜在的解决方法。有关详细信息,请从 Tomcat Wiki 阅读此内容:http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q27

另一种方法是使用 Zeroconf作为服务注册一个发现点,但这会改变你所有的应用程序。

关于java - tomcat 6如何选择部署WAR文件的顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22070340/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com