org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from resource loaded through InputStream is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".

MuleSoft JIRA | Cédric Vidal | 9 years ago
  1. 0

    When using a Spring 2 XML Schema based configuration file (spring2-context.xml) with the SpringConfigurationBuilder like this: {quote} SpringConfigurationBuilder builder = new SpringConfigurationBuilder(); builder.configure("mule-spring-conf.xml", "spring2-context.xml"); {quote} It fails with the following exception: org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". It looks like it is because the MuleBeanDefinitionReader class enforces DTD validation even if the validation used is XML Schema based: http://svn.codehaus.org/mule/tags/mule-1.4.1/modules/spring/src/main/java/org/mule/extras/spring/config/MuleBeanDefinitionReader.java The trunk seems to have this limitation also: http://svn.codehaus.org/mule/trunk/mule/modules/spring/src/main/java/org/mule/extras/spring/config/MuleBeanDefinitionReader.java Any workaround would be greatly appreciated in the meantime ;) Regards, Cédric PS: The full stack trace: {quote}Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from resource loaded through InputStream is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:359) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:158) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:184) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112) at org.mule.extras.spring.config.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:65) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:395) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:330) at org.mule.extras.spring.config.MuleApplicationContext.<init>(MuleApplicationContext.java:46) at org.mule.extras.spring.config.MuleApplicationContext.<init>(MuleApplicationContext.java:38) at org.mule.extras.spring.config.SpringConfigurationBuilder.configure(SpringConfigurationBuilder.java:99) at org.mule.extras.spring.config.SpringConfigurationBuilder.configure(SpringConfigurationBuilder.java:68) at com.vecteurplus.synergies.esb.SynergiesEsb.<init>(SynergiesEsb.java:31) at com.vecteurplus.synergies.esb.SynergiesEsb.main(SynergiesEsb.java:21) Caused by: org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:78) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:351) ... 16 more {quote}

    MuleSoft JIRA | 9 years ago | Cédric Vidal
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from resource loaded through InputStream is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
  2. 0

    When using a Spring 2 XML Schema based configuration file (spring2-context.xml) with the SpringConfigurationBuilder like this: {quote} SpringConfigurationBuilder builder = new SpringConfigurationBuilder(); builder.configure("mule-spring-conf.xml", "spring2-context.xml"); {quote} It fails with the following exception: org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". It looks like it is because the MuleBeanDefinitionReader class enforces DTD validation even if the validation used is XML Schema based: http://svn.codehaus.org/mule/tags/mule-1.4.1/modules/spring/src/main/java/org/mule/extras/spring/config/MuleBeanDefinitionReader.java The trunk seems to have this limitation also: http://svn.codehaus.org/mule/trunk/mule/modules/spring/src/main/java/org/mule/extras/spring/config/MuleBeanDefinitionReader.java Any workaround would be greatly appreciated in the meantime ;) Regards, Cédric PS: The full stack trace: {quote}Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from resource loaded through InputStream is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:359) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:158) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:184) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112) at org.mule.extras.spring.config.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:65) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:395) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:330) at org.mule.extras.spring.config.MuleApplicationContext.<init>(MuleApplicationContext.java:46) at org.mule.extras.spring.config.MuleApplicationContext.<init>(MuleApplicationContext.java:38) at org.mule.extras.spring.config.SpringConfigurationBuilder.configure(SpringConfigurationBuilder.java:99) at org.mule.extras.spring.config.SpringConfigurationBuilder.configure(SpringConfigurationBuilder.java:68) at com.vecteurplus.synergies.esb.SynergiesEsb.<init>(SynergiesEsb.java:31) at com.vecteurplus.synergies.esb.SynergiesEsb.main(SynergiesEsb.java:21) Caused by: org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:78) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:351) ... 16 more {quote}

    MuleSoft JIRA | 9 years ago | Cédric Vidal
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from resource loaded through InputStream is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
  3. 0

    Error Spring org.xml.sax.SAXParseException: Premature end of file On Jaxws Web Service

    Stack Overflow | 2 years ago | user3822212
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line -1 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Premature end of file.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to write Spring ApplicationContext.xml file?

    Stack Overflow | 3 years ago | Programmer
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 578; cvc-elt.1: Cannot find the declaration of element 'beans'.
  6. 0

    Binding web service (wsdl) error

    Stack Overflow | 4 years ago | nnhthuan
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML document from URL [bundleentry://232.fwk1459808981/META-INF/spring/binding.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 57; cvc-elt.1: Cannot find the declaration of element 'jaxws:bindings'.

    33 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.xml.sax.SAXParseException

      Document root element "beans", must match DOCTYPE root "null".

      at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException()
    2. Xerces2-j
      DocumentBuilderImpl.parse
      1. org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
      2. org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
      3. org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      4. org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      5. org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
      6. org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
      7. org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
      8. org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
      9. org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
      10. org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      11. org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      12. org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      13. org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      14. org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      15. org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
      16. org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
      16 frames
    3. Spring Beans
      AbstractBeanDefinitionReader.loadBeanDefinitions
      1. org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:78)
      2. org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:351)
      3. org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
      4. org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
      5. org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
      6. org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:158)
      7. org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:184)
      7 frames
    4. Spring Context
      AbstractXmlApplicationContext.loadBeanDefinitions
      1. org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112)
      1 frame
    5. org.mule.extras
      MuleApplicationContext.loadBeanDefinitions
      1. org.mule.extras.spring.config.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:65)
      1 frame
    6. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
      2. org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:395)
      3. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:330)
      3 frames
    7. org.mule.extras
      SpringConfigurationBuilder.configure
      1. org.mule.extras.spring.config.MuleApplicationContext.<init>(MuleApplicationContext.java:46)
      2. org.mule.extras.spring.config.MuleApplicationContext.<init>(MuleApplicationContext.java:38)
      3. org.mule.extras.spring.config.SpringConfigurationBuilder.configure(SpringConfigurationBuilder.java:99)
      4. org.mule.extras.spring.config.SpringConfigurationBuilder.configure(SpringConfigurationBuilder.java:68)
      4 frames
    8. com.vecteurplus.synergies
      SynergiesEsb.main
      1. com.vecteurplus.synergies.esb.SynergiesEsb.<init>(SynergiesEsb.java:31)
      2. com.vecteurplus.synergies.esb.SynergiesEsb.main(SynergiesEsb.java:21)
      2 frames