aspose file tools*
The moose likes Spring and the fly likes XmlBeanDefinitionStoreException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "XmlBeanDefinitionStoreException" Watch "XmlBeanDefinitionStoreException" New topic
Author

XmlBeanDefinitionStoreException

hardikR shah
Greenhorn

Joined: Nov 03, 2012
Posts: 1
I am a newbie in spring framework. I am trying my very first spring example which is given in Spring in action 3rd edition.
When i am trying to load the xml context file as follows in my main function



I am getting the following error ..

Nov 3, 2012 11:34:57 PM org.springframework.context.support.AbstractApplic ationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlAp plicationContext@ab50cd: startup date [Sat Nov 03 23:34:57 IST 2012]; root of context hierarchy
Nov 3, 2012 11:34:57 PM org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [ContextFile.xml]
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefin itionStoreException: Line 1 in XML document from class path resource [ContextFile.xml] is invalid; nested exception is org.xml.sax.SAXParseException: White space is required before the encoding pseudo attribute in the XML declaration.
at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:396)
at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:302)
at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:174)
at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:209)
at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:180)
at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:243)
at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:127)
at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:93)
at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:131)
at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:527)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:441)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)
at Spring.SpringDI.PerformerTest.main(PerformerTest.j ava:9)
Caused by: org.xml.sax.SAXParseException: White space is required before the encoding pseudo attribute in the XML declaration.
at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorRe porter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner .reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner .scanXMLDeclOrTextDecl(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanXMLDeclOrTextDecl(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl$XMLDeclDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocum entScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLPars er.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMPars er.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBu ilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocum entLoader.loadDocument(DefaultDocumentLoader.java: 75)
at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:388)
... 14 more


Can anyone let me know the reason for the error and its solution pl.

Thanks in advance..
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

There is probably something wrong in the header stuff.

Can you post your config file. Remember to use the CODE tags by using the Code button above when posting.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XmlBeanDefinitionStoreException
 
Similar Threads
Spring Beginners-Help Needed
Spring/XFire in OSGi platform
Spring batch 2.0 (How to stop calling sequence)
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException:
jar files in Eclipse