简体   繁体   中英

intermittent strange tomcat issues deploying war file

I have attempted to search this issue first, but found nothing with this exact issue.

I have an intermittent issue when I attempt to deploy a war file on our tomcat server. It occasionally fails with the following, forcing us to bounce tomcat before we can deploy.

Jan 08, 2013 11:50:20 AM org.apache.catalina.startup.HostConfig deployWAR SEVERE: Error deploying web application archive /usr/local/apache-tomcat-7.0.29/webapps /somewar.war javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:132)

Once we bounce tomcat, we can deploy the war file without issues. In fact, this failure is so random that I can't even reproduce this correctly.

Has anyone have any ideas on what could be going on?.

java version:

Java version "1.7.0_09" Java(TM) SE Runtime Environment (build 1.7.0_09-b05) Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

tomcat version:

Server version: Apache Tomcat/7.0.29 Server built: Jul 3 2012 11:31:52 Server number: 7.0.29.0 OS Name: Linux OS Version: 2.6.18-308.16.1.el5 Architecture: amd64 JVM Version: 1.7.0_09-b05 JVM Vendor: Oracle Corporation

I was able to consistently reproduce this issue by deploying two .war files at the same time with tomcat shutdown and then restarting tomcat. (I doubt it's relevant but the servlets for each .war file were very similar and had a xerces dependency also)

The issue appears to have been fixed by changing the web.xml file for each of the .war files as follows:

Change the 'load-on-startup' element value to be -1 instead of 1.

A possible cause is conflicting JAR files, ie you have multiple identical classes on your classpath. You can determine where a class is coming from inside your code with the following:

System.out.println(javax.xml.parsers.SAXParserFactory.class.getResource("SAXParserFactory.class"));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM