Saxon cannot write a DOMResult unless saxon9-dom.jar is on the classpath

启动项目报错:

Caused by: Unable to load jar:file:/G:/apache-tomcat-7.0.77/webapps/pen-portal/WEB-INF/lib/struts2-core-2.3.32.jar!/struts-default.xml - Class: net.sf.saxon.event.SerializerFactory
File: SerializerFactory.java
Method: getReceiver
Line: 200 - net/sf/saxon/event/SerializerFactory.java:200:-1
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1027)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:167)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:134)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:239)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
	... 21 more
Caused by: Saxon cannot write a DOMResult unless saxon9-dom.jar is on the classpath - Class: net.sf.saxon.event.SerializerFactory
File: SerializerFactory.java
Method: getReceiver
Line: 200 - net/sf/saxon/event/SerializerFactory.java:200:-1
	at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:119)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1021)
	... 25 more
Caused by: java.lang.UnsupportedOperationException: Saxon cannot write a DOMResult unless saxon9-dom.jar is on the classpath
	at net.sf.saxon.event.SerializerFactory.getReceiver(SerializerFactory.java:200)
	at net.sf.saxon.IdentityTransformerHandler.startDocument(IdentityTransformerHandler.java:97)
	at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.startDocument(DomHelper.java:237)
	at com.opensymphony.xwork2.util.location.LocationAttributes$Pipe.startDocument(LocationAttributes.java:306)
	at com.opensymphony.xwork2.util.DomHelper$StartHandler.startDocument(DomHelper.java:298)
	at org.apache.xerces.parsers.AbstractSAXParser.startDocument(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
	at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
	at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:117)
	... 26 more

一开始怀疑环境问题,然后将能跑的war包扔到tomcat里面发现没有问题,然后就怀疑是哪个jar包问题,但是不好找到对应的包,一开始先将lib整个考到出错的包里面,发现可以运行,定位到一定是某个jar包的问题.
然后通过二分法,一半一半的将lib拆分的进行判断,定位到

在这里插入图片描述
只要将这个包换掉项目就可以运行.然后发现包问题…

世界上所有的不公平都是由于当事人能力不足造成的.
原文地址:https://www.cnblogs.com/javayida/p/13347016.html