title: Getting a error in Spring Configuration XML file:org.xml.sax.SAXParseException
body: <p>I am trying to learn Spring MVC and trying some sample applications. I am getting an error Line 14 in XML document from ServletContext resource [/WEB-INF/config/sdnext-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 61; cvc-elt.1: Cannot find the declaration of element 'beans'. I am getting stuck in the middle because of this error. Please help me to fix the error.</p>
  
  <p>My Spring Configuration XML file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;beans xmlns="http://www.springframework.org/schema/beans"
  
          xmlns:context="http://www.springframework.org/schema/context" 
          xmlns:tx="http://www.springframework.org/schema/tx" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  
          xsi:schemalocation="  
          http://www.springframework.org/schema/beans  
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
          http://www.springframework.org/schema/context  
          http://www.springframework.org/schema/context/spring-context-3.0.xsd  
          http://www.springframework.org/schema/tx  
          http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"&gt;  
  
          &lt;context:property-placeholder location="classpath:resources/database.properties"&gt;  
          &lt;/context:property-placeholder&gt;  
          &lt;context:component-scan base-package="com.spring.hibernate"&gt;  
          &lt;/context:component-scan&gt;  
  
          &lt;tx:annotation-driven transaction-manager="hibernateTransactionManager"&gt;  
          &lt;/tx:annotation-driven&gt;  
  
          &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"                        id="jspViewResolver"&gt;  
          &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"&gt;           &lt;/property&gt;  
          &lt;property name="prefix" value="/WEB-INF/views/"&gt;&lt;/property&gt;  
          &lt;property name="suffix" value=".jsp"&gt;&lt;/property&gt;  
         &lt;/bean&gt;  
  
         &lt;bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="dataSource"&gt;  
        &lt;property name="driverClassName" value="${database.driver}"&gt;&lt;/property&gt;  
        &lt;property name="url" value="${database.url}"&gt;&lt;/property&gt;  
        &lt;property name="username" value="${database.user}"&gt;&lt;/property&gt;  
        &lt;property name="password" value="${database.password}"&gt;&lt;/property&gt;  
        &lt;/bean&gt;  
  
  &lt;bean class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" id="sessionFactory"&gt;  
        &lt;property name="dataSource" ref="dataSource"&gt;&lt;/property&gt;  
        &lt;property name="annotatedClasses"&gt;  
        &lt;list&gt;  
        &lt;value&gt;com.spring.hibernate.model.Employee&lt;/value&gt;  
        &lt;/list&gt;  
       &lt;/property&gt;  
      &lt;property name="hibernateProperties"&gt;  
      &lt;props&gt;  
       &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;  
        &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt;  
       &lt;prop key="hibernate.hbm2ddl.auto"&gt;${hibernate.hbm2ddl.auto}  &lt;/prop&gt;      
          &lt;/props&gt;  
        &lt;/property&gt;  
       &lt;/bean&gt;  
  
  
   &lt;bean class="org.springframework.orm.hibernate3.HibernateTransactionManager" id="hibernateTransactionManager"&gt;  
   &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;  
    &lt;/bean&gt;  
    &lt;/beans&gt;  
  </code></pre>
  
  <p>This is the line, I am getting the error exactly from the configuration file:<a href="http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" rel="nofollow">http://www.springframework.org/schema/tx/spring-tx-3.0.xsd</a>"</p>
  
  <p>My Console:</p>
  
  <pre><code>Mar 19, 2014 12:09:26 PM org.apache.catalina.core.AprLifecycleListener init
  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Riya/software_downloads/eclipse/jre/bin/server;C:/Riya/software_downloads/eclipse/jre/bin;C:/Riya/software_downloads/eclipse/jre/lib/amd64;C:\Program Files\Java\jdk1.7.0_09\bin;C:Program Files\apache-maven-3.2.1\bin;;C:\Riya\software_downloads\eclipse;;.
  Mar 19, 2014 12:09:26 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SpringHibernateApp' did not find a matching property.
  Mar 19, 2014 12:09:26 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-8086"]
  Mar 19, 2014 12:09:26 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
  Mar 19, 2014 12:09:26 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 442 ms
  Mar 19, 2014 12:09:26 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  Mar 19, 2014 12:09:26 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.34
  log4j:WARN No appenders could be found for logger (org.springframework.web.servlet.DispatcherServlet).
  log4j:WARN Please initialize the log4j system properly.
  Mar 19, 2014 12:09:28 PM org.apache.catalina.core.ApplicationContext log
  INFO: Initializing Spring FrameworkServlet 'sdnext'
  Mar 19, 2014 12:09:28 PM org.apache.catalina.core.ApplicationContext log
  SEVERE: StandardWrapper.Throwable
  org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from ServletContext resource [/WEB-INF/config/sdnext-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 61; cvc-elt.1: Cannot find the declaration of element 'beans'.
      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.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
      at javax.servlet.GenericServlet.init(GenericServlet.java:160)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1267)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 61; cvc-elt.1: Cannot find the declaration of element 'beans'.
      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.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
      at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.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:75)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
      ... 29 more
  
  Mar 19, 2014 12:09:28 PM org.apache.catalina.core.StandardContext loadOnStartup
  SEVERE: Servlet /SpringHibernateApp threw load() exception
  org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 61; cvc-elt.1: Cannot find the declaration of element 'beans'.
      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.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
      at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.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:75)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
      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.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
      at javax.servlet.GenericServlet.init(GenericServlet.java:160)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1267)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  
  Mar 19, 2014 12:09:28 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-8086"]
  Mar 19, 2014 12:09:28 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-bio-8009"]
  Mar 19, 2014 12:09:28 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 1904 ms
  </code></pre>