title: resources/hibernate.cfg.xml not found
body: <p>I am learning to use Hibernate in my Java web app. I have the following sessionFactory started with a configuration for the location of my hibernate.cfg.xml file, but it still complains: <code>resources/hibernate.cfg.xml not found</code></p>
  
  <p><strong>The "resources" folder is a subdirectory of my "src" folder in the java project.</strong></p>
  
  <pre><code>public class HibernateUtil
  {
      private static final SessionFactory sessionFactory = new Configuration().configure("resources/hibernate.cfg.xml").buildSessionFactory();
  
      public static void main(String[] args)
      {
          Session session = sessionFactory.getCurrentSession();
          Transaction tx = session.beginTransaction();
  
          Book book1 = new Book("John Wright", "Unknown Title");
          session.save(book1);
          tx.commit();
  
          System.out.println("Book committed: book title: " + book1.getTitle() + ", author is: " + book1.getAuthor());
          sessionFactory.close();
      }
  
  
  }
  </code></pre>
  
  <p>The hibernate dependency I'm using in my pom.xml is as follows, but <strong>intelliJ warns that the buildSessionFactory() method is deprecated</strong> by highlight a "Strikethrough"</p>
  
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;4.3.5.Final&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>I am posting the error message from my i at the very bottom as well. What is going wrong? thanks</p>
  
  <pre><code>10:43:12.737 [main] INFO  o.h.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
  10:43:12.746 [main] INFO  org.hibernate.Version - HHH000412: Hibernate Core {4.3.1.Final}
  10:43:12.747 [main] INFO  org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
  10:43:12.749 [main] INFO  org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
  Exception in thread "main" java.lang.ExceptionInInitializerError
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:259)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:116)
  Caused by: org.hibernate.HibernateException: resources/hibernate.cfg.xml not found
      at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173)
      at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2093)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:2074)
      at persistence.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:14)
      ... 3 more
  10:43:12.763 [main] INFO  org.hibernate.cfg.Configuration - HHH000043: Configuring from resource: resources/hibernate.cfg.xml
  10:43:12.763 [main] INFO  org.hibernate.cfg.Configuration - HHH000040: Configuration resource: resources/hibernate.cfg.xml
  
  Process finished with exit code 1
  </code></pre>