Parse Error at line 2 column 15: Document is invalid: no grammar found.
今天部署把项目部署到tomcat上面时,发现了一个错误,.
严重: Document is invalid: no grammar found. at (null:3:8)
org.xml.sax.SAXParseException: Document is invalid: no grammar found.
?at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
?at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
?at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
?at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
?at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:177)
?at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:779)
?at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
?at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
?at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
?at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
?at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
?at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
?at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
?at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:121)
?at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:830)
?at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
?at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
?at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
?at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
?at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
?at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
?at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
?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.<init>(ApplicationFilterConfig.java:108)
?at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)
?at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
?at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
?at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
?at org.apache.catalina.core.StandardService.start(StandardService.java:516)
?at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
?at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
?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:592)
?at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
?at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
?
提示文件解析错误,你要解析的文件格式可能不对..
?
?
?
?
是因为我的struts.xml文件中少加了,如下dtd的验证,.所以导致出错..
加上去就ok. 重启服务器..
?
<!DOCTYPE struts PUBLIC
? "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">?