title: Hibernate can't read hibernate.cfg.xml file
body: <p>I am attempting to complete <a href="http://www.youtube.com/playlist?list=PL4AFF701184976B25" rel="nofollow noreferrer">this Java Brains tutorial on hibernate</a>, using hibernate3.6.10.Final and Eclipse IDE, and I am encountering an exception that is not covered in the video. Here is the output:</p>
  
  <pre><code>SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  Exception in thread "main" java.lang.ExceptionInInitializerError
      at org.hibernate.cfg.Configuration.reset(Configuration.java:332)
      at org.hibernate.cfg.Configuration.&lt;init&gt;(Configuration.java:298)
      at org.hibernate.cfg.Configuration.&lt;init&gt;(Configuration.java:302)
      at com.helo478.firsthibernateproject.SimpleTest.setUpHibernate(SimpleTest.java:31)
      at com.helo478.firsthibernateproject.SimpleTest.main(SimpleTest.java:19)
  Caused by: java.lang.NullPointerException
      at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:167)
      at org.hibernate.cfg.Environment.&lt;clinit&gt;(Environment.java:618)
      ... 5 more
  </code></pre>
  
  <p>[EDIT] I thought the first 3 lines of code were irrelevent, because I've seen a working version of this program (in the tutorial) that had that output. However, it seems that the issue was, indeed with the slf4j jars. Thank you @Jayaram Pradhan and @ drurenia[/EDIT]</p>
  
  <p>I did some searching on StackOverflow already and found <a href="https://stackoverflow.com/questions/17459273/hibernate-cfg-xml-of-hibernate/17556418#17556418">this similar case</a> (actually they were probably doing the same tutorial). Unfortunately, that thread does not, at this time, have a usable solution. The questioner solved their problem by starting from scratch and using a different database. I have done that (using both PostgreSQL and MySQL), and I get the same error on each. </p>
  
  <p>The other response indicated that the configuration file should be in the project root directory and that the Configurations.configure() method takes an optional String filepath. I have tried placing the hibernate.cfg.xml file in both the project root directory, as well as the "src" directory. I have also tried pointing to the file in with an argument on the .configure() method. There is no change in output.</p>
  
  <p>Because every line of my Java code is taken directly from the tutorial, I think it is most likely that there is a problem with my hibernate.cfg.xml file. The file is altered from a template that was packaged with hibernate3. I just changed it to reference the MySQL database. Being new to Hibernate, I suppose I must have made a mistake there. Here is the complete text:</p>
  
  <p>
      </p>
  
  <pre><code>&lt;hibernate-configuration&gt;
  
      &lt;session-factory&gt;
  
          &lt;!-- Database connection settings --&gt;
          &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:mysql://localhost:3306/hibernatedb&lt;/property&gt;
          &lt;property name="connection.username"&gt;root&lt;/property&gt;
          &lt;property name="connection.password"&gt;password&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.MySQL5Dialect&lt;/property&gt;
  
          &lt;!-- Disable the second-level cache --&gt;
          &lt;property name="cache.provider_class"&gt;org.hibernate.cache.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;create&lt;/property&gt;
  
          &lt;!-- Names the annotated entity class --&gt;
          &lt;mapping class="com.helo478.firsthibernateproject.User" /&gt;
  
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>My question is this:</p>
  
  <p>What, if anything, am I doing wrong in my hibernate.cfg.xml file? If nothing is wrong, what else might explain the failure? </p>