title: Hibernate exception on startup
body: <p>I have just started learning Hibernate. For that I have written a simple Java Program.
  But when I try to execute the program I am getting following exception.</p>
  
  <pre><code>Apr 30, 2014 1:54:18 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt;
  INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
  Apr 30, 2014 1:54:18 PM org.hibernate.Version logVersion
  INFO: HHH000412: Hibernate Core {4.3.5.Final}
  Exception in thread "main" java.lang.ExceptionInInitializerError
      at org.hibernate.cfg.Configuration.reset(Configuration.java:324)
      at org.hibernate.cfg.Configuration.&lt;init&gt;(Configuration.java:289)
      at org.hibernate.cfg.Configuration.&lt;init&gt;(Configuration.java:293)
      at com.hiber.main.Main.main(Main.java:19)
  Caused by: java.lang.NullPointerException
      at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
      at org.hibernate.cfg.Environment.&lt;clinit&gt;(Environment.java:221)
      ... 4 more
  </code></pre>
  
  <p>Following is the program:</p>
  
  <pre><code>package com.hiber.main;
  
  import javax.naming.NamingException;
  
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
  import org.hibernate.cfg.Configuration;
  import org.hibernate.service.ServiceRegistry;
  
  public class Main {
  
      public static void main(String[] args) throws NamingException {
          //SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(new StandardServiceRegistryBuilder().build());
  
          ServiceRegistry serviceRegistry;
          SessionFactory sessionFactory;
  
          Configuration configuration = new Configuration();
          configuration.configure("/com/hiber/main/hibernate.cfg.xml");
          serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
          sessionFactory = configuration.buildSessionFactory(serviceRegistry);
  
          Session sess = sessionFactory.getCurrentSession();
          sessionFactory.openSession();
          sess.beginTransaction();
  
          Test1 t = new Test1();
          t.setTest1Ind(1);
          t.setName("name");
          t.setPassword("abcd1234");
          sess.saveOrUpdate(t);
  
          sess.getTransaction().commit();
          sess.close();
  
  
      }
  
  }
  </code></pre>
  
  <p>Following is the cfg xml:</p>
  
  <pre><code>&lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="hibernate.connection.password"&gt;root1234&lt;/property&gt;
          &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/test&lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;
          &lt;property name="hibernate.default_schema"&gt;test&lt;/property&gt;
          &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
          &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I have included all the dependencies. Hopefully I haven't missed anything. 
  Can't add image currently.</p>
  
  <p>Please anyone have a look at the code and spare a thought on what might be going wrong here.
  Thanks in advance.</p>