struts2 Unable to load file

异常如下:
严重: Exception starting filter struts2
Unable to load configuration. - include - file:/D:/Program%20Files/apache-tomcat-6.0.10/webapps/CS2007CS1/WEB-INF/classes/struts.xml:5:44
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
	at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
	at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
	at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1307)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1571)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1580)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1560)
	at java.lang.Thread.run(Thread.java:595)
Caused by: Unable to load configuration. - include - file:/D:/Program%20Files/apache-tomcat-6.0.10/webapps/CS2007CS1/WEB-INF/classes/struts.xml:5:44
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
	... 16 more
Caused by: Unable to load file:/D:/Program%20Files/apache-tomcat-6.0.10/webapps/CS2007CS1/WEB-INF/classes/org/action/fileprocess.xml - include - file:/D:/Program%20Files/apache-tomcat-6.0.10/webapps/CS2007CS1/WEB-INF/classes/struts.xml:5:44
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:896)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:945)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:143)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:110)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:168)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
	... 18 more
Caused by: The markup declarations contained or pointed to by the document type declaration must be well-formed. - http://172.17.1.43:1:2
	at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:893)
	... 23 more
Caused by: org.xml.sax.SAXParseException: The markup declarations contained or pointed to by the document type declaration must be well-formed.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
	at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
	at org.apache.xerces.impl.XMLDTDScannerImpl.scanDecls(Unknown Source)
	at org.apache.xerces.impl.XMLDTDScannerImpl.scanDTDExternalSubset(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(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 javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:113)
	... 24 more
2012-3-13 6:33:51 org.apache.catalina.core.StandardContext start
严重: Error filterStart
问题原因:
此处造成文件不能加载的原因应该是红色划线部分,经查看,struts.xml中文件如下:





    
fileprocess.xml文件如下:



	
		
			/fileprocess/fileuploadsuccess.jsp
			/fileprocess/fileupload.jsp
		
		
			/fileprocess/fileupload.jsp
		
	

发现上述两文件的声明不一样。
解决方法:将fileprocess.xml中的声明部分改成和struts.xml一样,问题即可解决。

 
  
 
 

你可能感兴趣的:(异常集合)