2 qq 33363459 qq_33363459 于 2016.01.14 15:49 提问

不知道为什么今天启动struts2练习项目都出错了,都是同一个错误。

Unable to load configuration. - file:/D:/Program%20Files/Java/apache-tomcat-6.0.32/webapps/strutsdemo3/WEB-INF/classes/struts.xml:17:10
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:502)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: Unable to load configuration. - file:/D:/Program%20Files/Java/apache-tomcat-6.0.32/webapps/strutsdemo3/WEB-INF/classes/struts.xml:17:10
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
... 29 more
Caused by: Unable to load file:/D:/Program%20Files/Java/apache-tomcat-6.0.32/webapps/strutsdemo3/WEB-INF/classes/struts.xml - file:/D:/Program%20Files/Java/apache-tomcat-6.0.32/webapps/strutsdemo3/WEB-INF/classes/struts.xml:17:10
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1022)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:165)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:132)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:225)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 31 more
Caused by: The content of element type "action" must match "(param|result|interceptor-ref|exception-mapping)*". - file:/D:/Program%20Files/Java/apache-tomcat-6.0.32/webapps/strutsdemo3/WEB-INF/classes/struts.xml:17:10
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:119)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1017)
... 35 more
Caused by: org.xml.sax.SAXParseException: The content of element type "action" must match "(param|result|interceptor-ref|exception-mapping)*".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:117)
... 36 more图片

6个回答

P923284735
P923284735   2016.01.14 16:04

不能加载配置文件··

qq_33363459
qq_33363459 昨天测试没问题出现,今天就出现这状况
接近 2 年之前 回复
qq_33363459
qq_33363459 昨天做那时还行的,今天一部署到tomcat问题就出现了,1-6都不行,一样的问题
接近 2 年之前 回复
P923284735
P923284735 file:/D:/Program%20Files/Java/apache-tomcat-6.0.32/webapps/strutsdemo3/WEB-INF/classes/struts.xml:17:10 你自己看看这个文件
接近 2 年之前 回复
P923284735
P923284735   2016.01.14 16:04

file:/D:/Program%20Files/Java/apache-tomcat-6.0.32/webapps/strutsdemo3/WEB-INF/classes/struts.xml

oXinLiang12
oXinLiang12   2016.01.14 16:14

你的strtus配置文件应该是有问题,可以贴个图出来看看~

qq_33363459
qq_33363459   2016.01.14 16:20

图片说明图片说明图片说明图片说明图片说明图片说明图片说明图片

Royal_lr
Royal_lr 图片看不清楚啊
接近 2 年之前 回复
Royal_lr
Royal_lr   Ds   Rxr 2016.01.14 16:21

strutsdemo3,将这个项目的struts.xml贴出来看看

Royal_lr
Royal_lr 回复fff嘉裕: 一直报3的话,,应该就是3的问题
接近 2 年之前 回复
qq_33363459
qq_33363459 突然发现在3这个struts.xml里面写了这个 <package name="default" namespace="/" extends="struts-default"> <default-action-ref name="defaultAction"></default-action-ref> <action name="defaultAction"> <global-results> <result >/error.jsp</result> </global-results> </action> </package> 刚我把这个删了就行了 <global-results> <result >/error.jsp</result> </global-results>
接近 2 年之前 回复
qq_33363459
qq_33363459 是啊
接近 2 年之前 回复
Royal_lr
Royal_lr 回复fff嘉裕: 启动其他的还是报第三个的错误是吧
接近 2 年之前 回复
qq_33363459
qq_33363459 启动第一个也是一样的问题
接近 2 年之前 回复
Royal_lr
Royal_lr 回复fff嘉裕: 那就是从第三个开始的
接近 2 年之前 回复
qq_33363459
qq_33363459 不止strutsdemo3这个项目出问题,其他的都出一样的问题
接近 2 年之前 回复
qq_33363459
qq_33363459   2016.01.14 16:25

。………………………图片

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!