title: Hibernate: Document is invalid: no grammar found
body: <p>When I instantiate Hibernate using the following code:</p>
  
  <pre><code>        Configuration configuration = new Configuration();
          configuration.configure();
          serviceRegistry = new ServiceRegistryBuilder().applySettings(
                  configuration.getProperties()).buildServiceRegistry();
          sessionFactory = configuration.buildSessionFactory(serviceRegistry);
  </code></pre>
  
  <p>I got the following exceptions:</p>
  
  <blockquote>
    <p>org.xml.sax.SAXParseException: Document is invalid: no grammar found.,
    org.xml.sax.SAXParseException: Document root element
    "hibernate-configuration", must match DOCTYPE root "null".
        Caused by: org.hibernate.MappingException: invalid configuration
          at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2014)
          at org.hibernate.cfg.Configuration.configure(Configuration.java:1931)
          at org.hibernate.cfg.Configuration.configure(Configuration.java:1910)
          at com.soccer.system.HibernateUtil.(HibernateUtil.java:23)
          ... 1 more
        Caused by: org.xml.sax.SAXParseException: Document is invalid: no grammar found.</p>
  </blockquote>
  
  <p>I use the following <code>hibernate.cfg.xml</code> file with Hibernate 4.1.6:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  
  &lt;hibernate-configuration
      xmlns="http://www.hibernate.org/xsd/hibernate-configuration"
      xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration hibernate-configuration-4.0.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;session-factory&gt;
          &lt;!-- Database connection settings --&gt;
          &lt;property name="connection.driver_class"&gt;org.apache.derby.jdbc.ClientDriver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:derby://localhost:1527/K:\db&lt;/property&gt;
          &lt;property name="connection.username"&gt;&lt;/property&gt;
          &lt;property name="connection.password"&gt;&lt;/property&gt;
  
          &lt;!-- JDBC connection pool (use the built-in) --&gt;
          &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
  
          &lt;!-- SQL dialect --&gt;
          &lt;property name="dialect"&gt;org.hibernate.dialect.DerbyDialect&lt;/property&gt;
  
          &lt;!-- Enable Hibernate's automatic session context management --&gt;
          &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
  
          &lt;!-- Disable the second-level cache --&gt;
          &lt;property name="cache.provider_class"&gt;org.hibernate.cache.internal.NoCacheProvider&lt;/property&gt;
  
          &lt;!-- Echo all executed SQL to stdout --&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
  
          &lt;!-- Drop and re-create the database schema on startup --&gt;
          &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>What can I do to eliminate this exception?</p>