title: Hibernate 4.3.6 Configuration with Oracle 11g
body: <p>I am trying to configure Hibernate 4.3.6 with Oracle 11g, but i am not able to configure...I am<br>
      getting Null Pointer Exception while Creating the Session...i am putting all the configuration 
      and program file, kindly help me to get the root cause of the failure</p>
  
  <pre><code>    hibernate.cfg.xml
  
      &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
  
      &lt;property name="hibernate.connection.driver_class"&gt;oracle.jdbc.driver.OracleDriver&lt;/property&gt;
      &lt;property name="hibernate.connection.url"&gt;jdbc:oracle:thin:@127.0.0.1:1521:XE&lt;/property&gt;
      &lt;property name="username"&gt;TEST&lt;/property&gt;
      &lt;property name="password"&gt;ORACLE&lt;/property&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.OracleDialect&lt;/property&gt;
      &lt;property name="show_sql"&gt;true&lt;/property&gt;
      &lt;property name="hibernate.connection.pool_size"&gt;5&lt;/property&gt;  
      &lt;/session-factory&gt; 
  &lt;/hibernate-configuration&gt;
  
  HibernateUtil.java
  
  public class HibernateUtil {
      private static SessionFactory sessionFactory;
      private static ServiceRegistry serviceRegistry;
      public static SessionFactory createSessionFactory() {
          try{
              Configuration configuration = new Configuration();
              configuration.configure("hibernate.cfg.xml");
              serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
                      configuration.getProperties()).build();
              sessionFactory = configuration.buildSessionFactory(serviceRegistry);
              return sessionFactory;
          }
          catch (Throwable ex) {
              // Make sure you log the exception, as it might be swallowed
              System.err.println("Initial SessionFactory creation failed." + ex);
              throw new ExceptionInInitializerError(ex);
          }
      }
      public static SessionFactory getSessionFactory() {
            return sessionFactory;
      }
  }
  
  FetchTest.java
  
  public class FetchTest {
  &lt;br&gt;
      public  static void main(String a[]){&lt;br&gt;
          System.out.println("*********************** Inside Main ***********************");
  
          &lt;br&gt;&lt;br&gt;
              Session session = HibernateUtil.getSessionFactory().openSession(); 
      }
  }
  
  Output : -
  
  *********************** Inside Main ***********************
  Exception in thread "main" java.lang.NullPointerException
      at com.naveen.org.FetchTest.main(FetchTest.java:18)
  
  Please give your suggestions how to get ride from this.....?
  </code></pre>