我有一套Web应用程序作为许多WAR文件部署。我已将此代码部署到许多VM并且运行良好。我的devops团队创建了一个新的虚拟机,它基本上是其他虚拟机的副本,其中一个网络应用程序在启动时抛出异常。错误如下所示。在比较环境时,我注意到有错误的VM正在以不同于其他服务器的顺序部署应用程序。我想那里可能有些东西。如何强制tomcat按指定的顺序部署webapps,这恰好是其他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
答案 0 :(得分:2)
不幸的是,没有这样的事情,因为Tomcat从未支持部署订单
没有预期的启动订单。 Servlet规范和Tomcat都没有定义。您不能依赖以任何特定顺序开始的应用程序。
无论如何,通过在server.xml文件上指定部署顺序,可能会有一种解决方法。有关详细信息,请从Tomcat Wiki中阅读:http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q27
另一种方法是使用Zeroconf作为服务注册和发现点,但这会改变所有应用。
答案 1 :(得分:0)
事实证明我的班级装载机是红鲱鱼。我需要添加以下VM参数
-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
-Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
我在另一个堆栈溢出问题上找到了这个解决方案:Parser configuration exception parsing XML from class path resource