October 17, 2016 10:14:30 pm Org.springframework.context.support.AbstractApplicationContext Preparerefresh
Information: Refreshing org[email protected]2e0fa5d3:startup date [Mon Oct 22:14:30 CST 2016]; Root of context Hierarchy
October 17, 2016 10:14:30 pm Org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadbeandefinitions
Info: Loading XML Bean Definitions from class path resource [Bean.xml]
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:Line 1 in XML document from class path resource [Bean.xml] was invalid; nested exception is Org.xml.sax.SAXParseExcepti On linenumber:1; Columnnumber:8; No processing instruction target matching "[Xx][mm][ll]" is allowed。
At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions ( xmlbeandefinitionreader.java:396)
At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions ( xmlbeandefinitionreader.java:334)
At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions ( xmlbeandefinitionreader.java:302)
At Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:143)
At Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:178)
At Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:149)
At Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:212)
At Org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions ( abstractxmlapplicationcontext.java:126)
At Org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions ( abstractxmlapplicationcontext.java:92)
At Org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory ( abstractrefreshableapplicationcontext.java:130)
At Org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory ( abstractapplicationcontext.java:467)
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:397)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( classpathxmlapplicationcontext.java:139)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( CLASSPATHXMLAPPLICATIONCONTEXT.JAVA:83)
At TestSpring.test.main (test.java:9)
Caused by:org.xml.sax.SAXParseException, Linenumber:1, columnnumber:8; the processing instruction target that matches "[Xx][mm][ll]" is not allowed.
At Com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (Errorhandlerwrapper.java : 203)
At Com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError (errorhandlerwrapper.java:177)
At Com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (xmlerrorreporter.java:441)
At Com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (xmlerrorreporter.java:368)
At Com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError (xmlscanner.java:1436)
At Com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData (xmlscanner.java:723)
At Com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData ( xmldocumentfragmentscannerimpl.java:1018)
At Com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI (xmlscanner.java:691)
At Com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl$prologdriver.next (XMLDocumentScannerImpl.java : 912)
At Com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next (xmldocumentscannerimpl.java:606)
At Com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next (xmlnsdocumentscannerimpl.java:117)
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:848)
At Com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (xml11configuration.java:777)
At Com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (xmlparser.java:141)
At Com.sun.org.apache.xerces.internal.parsers.DOMParser.parse (domparser.java:243)
At Com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse (documentbuilderimpl.java:348)
At Org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument (defaultdocumentloader.java:75)
At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions ( xmlbeandefinitionreader.java:388)
... More
Problem Resolution: This bug was encountered because of an error in the first sentence of the XML file.
Workaround:
1, ensure that the first sentence of XML <?xml version= "1.0" encoding= "UTF-8"?> before there are no spaces.
2, copy the XML file on the Web, it is suggested that this sentence <?xml version= "1.0" encoding= "UTF-8"?> do not copy, keep the generated file when generated this code <?xml version= "1.0" Encoding= "UTF-8", so you can avoid this bug.
Bug Solution: org.xml.sax.SAXParseException; linenumber:1; Columnnumber:8; No processing instruction target matching "[Xx][mm][ll]" is allowed