Org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:Line 1 in XML document from class path resource [ Beans.xml] is invalid; Nested exception is org.xml.sax.SAXParseException:White spaces is required between publicid and SystemID.
At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions ( xmlbeandefinitionreader.java:404)
At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions ( xmlbeandefinitionreader.java:342)
At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions ( xmlbeandefinitionreader.java:310)
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:113)
At Org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions ( ABSTRACTXMLAPPLICATIONCONTEXT.JAVA:80)
At Org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory ( abstractrefreshableapplicationcontext.java:123)
At Org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory ( abstractapplicationcontext.java:423)
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:353)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( classpathxmlapplicationcontext.java:139)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( CLASSPATHXMLAPPLICATIONCONTEXT.JAVA:83)
At JUnit. Testdao.saveelectext (testdao.java:15)
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.junit.runners.model.frameworkmethod$1.runreflectivecall (frameworkmethod.java:44)
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:15)
At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:41)
At Org.junit.internal.runners.statements.InvokeMethod.evaluate (invokemethod.java:20)
At Org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored (blockjunit4classrunner.java:79)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:71)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:49)
At Org.junit.runners.parentrunner$3.run (parentrunner.java:193)
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:52)
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:191)
At org.junit.runners.parentrunner.access$000 (parentrunner.java:42)
At Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:184)
At Org.junit.runners.ParentRunner.run (parentrunner.java:236)
At Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (junit4testreference.java:50)
At Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197)
caused by:org.xml.sax.SAXParseException:White spaces is required between publicid and SystemID.
At Com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (Errorhandlerwrapper.java : 195)
At Com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError (errorhandlerwrapper.java:174)
At Com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (xmlerrorreporter.java:388)
At Com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError (xmlscanner.java:1427)
At Com.sun.org.apache.xerces.internal.impl.XMLScanner.scanExternalID (xmlscanner.java:1039)
At Com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.scanDoctypeDecl (Xmldocumentscannerimpl.java : 687)
At Com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl$prologdriver.next (XMLDocumentScannerImpl.java : 967)
At Com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next (xmldocumentscannerimpl.java:647)
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:511)
At Com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse (schemaparsingconfig.java:435)
At Com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse (schemaparsingconfig.java:491)
At Com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse (schemadomparser.java:510)
At Com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument (xsdhandler.java:1802)
This error is mainly caused by the following error:
<p:beans
xmlns:aop= "http://www.springframework.org/ Schema/aop "&NBSP;
xmlns:context=" Http://www.springframework.org/schema/context "&NBSP;
xmlns:p=" http:// Www.springframework.org/schema/beans "&NBSP;
xmlns:tx=" Http://www.springframework.org/schema/tx "&NBSP;
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" &NBSP;
xsi:schemalocation= "http:// www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/ Spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http:// www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/ context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd ";
In schemalocation, when an XSD file is introduced, the type of the file must be brought in after the auto-generated key, such as:/spring-tx-2.5.xsd, which would otherwise cause this exception error
Another is that the introduction of these files does not introduce a similar following:
Http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
If you forget the introduction, it will also cause this error.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
White spaces is required between publicid and SystemID