在SSH整合时,启动Tomcat第一次能正常运行,当redeploy出现了如下的错误提示:
Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
...
Caused by: Caught exception while loading file struts-default.xml - [unknown location]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:894)
...
Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
at org.apache.xerces.parsers.DOMParser.
...
从错误中的Caused by中提到的原因,应该是XML解析包的冲突问题。
找打hibernate中引入的jar包,并且检查Tomcat的webapps文件夹下的部署好的项目中,发现WEB-INF/lib里面有两个XML解析包: xml-apis.jar和xerces-2.6.2.jar。
原来是MyEclipse Hibernate类库中的两个包xml-apis.jar和xerces-2.6.2.jar的功能和JDK的发生冲突。
解决方法就是: 删除引入的xerces-2.6.2.jar,并且删除webapps下的工程部署目录,重启服务器使得重新部署。.