我是靠谱客的博主 聪明树叶,最近开发中收集的这篇文章主要介绍ERROR com.opensymphony.xwork2.util.DomHelper - 文档无效: 找不到语法。 at (null:3:8),觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
关于struts2框架报如下错误:
20:16:20.201 [localhost-startStop-1] ERROR com.opensymphony.xwork2.util.DomHelper - 文档无效: 找不到语法。 at (null:3:8)
org.xml.sax.SAXParseException: 文档无效: 找不到语法。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) [?:1.7.0_79]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source) [?:1.7.0_79]
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:117) [xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1021) [xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:167) [xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:134) [xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:239) [xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) [xwork-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:970) [struts2-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:438) [struts2-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:482) [struts2-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) [struts2-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) [struts2-core-2.3.28.jar:2.3.28]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) [catalina.jar:7.0.75]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) [catalina.jar:7.0.75]
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) [catalina.jar:7.0.75]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4958) [catalina.jar:7.0.75]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652) [catalina.jar:7.0.75]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) [catalina.jar:7.0.75]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571) [catalina.jar:7.0.75]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561) [catalina.jar:7.0.75]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.7.0_79]
at java.lang.Thread.run(Unknown Source) [?:1.7.0_79]
20:16:20.219 [localhost-startStop-1] ERROR org.apache.struts2.dispatcher.Dispatcher - Dispatcher initialization failed
com.opensymphony.xwork2.config.ConfigurationException: Unable to load configuration.
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) ~[xwork-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:970) ~[struts2-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:438) ~[struts2-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:482) [struts2-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) [struts2-core-2.3.28.jar:2.3.28]
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) [struts2-core-2.3.28.jar:2.3.28]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) [catalina.jar:7.0.75]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) [catalina.jar:7.0.75]
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) [catalina.jar:7.0.75]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4958) [catalina.jar:7.0.75]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652) [catalina.jar:7.0.75]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) [catalina.jar:7.0.75]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571) [catalina.jar:7.0.75]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561) [catalina.jar:7.0.75]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.7.0_79]
at java.lang.Thread.run(Unknown Source) [?:1.7.0_79]
Caused by: com.opensymphony.xwork2.config.ConfigurationException: Unable to load file:/D:/workspace1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Framework_struts/WEB-INF/classes/struts.xml
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1027) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:167) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:134) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:239) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) ~[xwork-core-2.3.28.jar:2.3.28]
... 17 more
Caused by: com.opensymphony.xwork2.XWorkException
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:119) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1021) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:167) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:134) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:239) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) ~[xwork-core-2.3.28.jar:2.3.28]
... 17 more
Caused by: org.xml.sax.SAXParseException: 文档无效: 找不到语法。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) ~[?:1.7.0_79]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source) ~[?:1.7.0_79]
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:117) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1021) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:167) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:134) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:239) ~[xwork-core-2.3.28.jar:2.3.28]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) ~[xwork-core-2.3.28.jar:2.3.28]
... 17 more
百度了一下。就不吐槽了
然后自己找出之前写的框架。发现原因如下:
struts.xml 我以为就是个简单的xml所以随手新建了一个,忘了里面有个dtd约束,加上之后就好了。
最后的struts.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!--pageckage:用于管理action的
name:是包的名字,随便命名,用于被继承的
namespace:工作空间是路径的一部分http://localhost:8080/struts2/test/helloworld.action
extends:继承于谁
extends="struts-default":在struts2的核心jar文件下有一个struts-default.xml文件 文件下有个package叫做struts-default,里面定义许多方法-->
<package name="csdn" namespace="/test" extends="struts-default">
<!-- name:请求的地址,用于匹配浏览器中路径中工作空间后的那一部分也就是上面路径中的helloworld.action,其中在浏览器中输入的时候.action可写可不写
class:类名,这个action所在的位置
method:处理的方法,helloworld.java中的方法名 -->
<action name="helloworld" class="tm.change.domain.HelloWorldAction"
method="execute">
<!-- result:对上面的method处理之后返回的结果进行处理
name:用于匹配method返回的结果,这边name="success"意思是说,如果execute()方法返回了"success",那么久跳转到/WEB-INF/page/hello.jsp -->
<result name="success">/WEB-INF/page/hello.jsp</result>
</action>
</package>
</struts>
最后
以上就是聪明树叶为你收集整理的ERROR com.opensymphony.xwork2.util.DomHelper - 文档无效: 找不到语法。 at (null:3:8)的全部内容,希望文章能够帮你解决ERROR com.opensymphony.xwork2.util.DomHelper - 文档无效: 找不到语法。 at (null:3:8)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复