title: SessionFactory code in Hiberante is not executing/proceeding
body: <p>Following is my java class. I am using Hibernate 5.2.11 with jdk1.8. Even I tried with other 5.2.x versions but still my program just exits from very first line of code always( mentioned in class ).</p>
  
  <pre><code>import org.hibernate.HibernateException;
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.boot.Metadata;
  import org.hibernate.boot.MetadataSources;
  import org.hibernate.boot.registry.StandardServiceRegistry;
  import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
  
  public class HibernateCfg {
  
  // private static final Logger logger =
  // LogManager.getLogger(HibernateCfg.class.getName());
  
  private static HibernateCfg hc = null;
  private static final Object object = new Object();
  private SessionFactory sessionFactory;
  private StandardServiceRegistry registry;
  private Session session;
  
  private HibernateCfg() {
  
      sessionFactory = getSessionFactory();
      // Create registry
  
  }
  
  private SessionFactory getSessionFactory() {
  
      try {
  //code stops here at below line
          StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder()
                  .configure("/hibernate.cfg.xml").build();
          Metadata metadata = new MetadataSources(standardRegistry).getMetadataBuilder().build();
          sessionFactory = metadata.getSessionFactoryBuilder().build();
          return sessionFactory;
      } catch (Exception e) {
  
      }
      return null;
  
  }
  
  public static HibernateCfg getObject() {
      if (hc == null) {
          synchronized (object) {
              if (hc == null) {
                  hc = new HibernateCfg();
              }
          }
  
      }
      return hc;
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/8uWZb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8uWZb.png" alt="enter image description here"></a></p>
  
  <p>What seems to be the problem ?</p>