title: Hibernate configuredSession factory : null
body: <p>HI all I'm getting the following message in my logs:<br>
  2013-05-14 01:32:47,079}ABSOLUTE{  INFO org.hibernate.cfg.Configuration}1{:2074 - HHH000041: Configured SessionFactory: null</p>
  
  <p>I have an issue with my app eventually failing because of TOO MANY CONNECTIONS.  I have a haunting feeling these are related.  I've read up on this; on this site, but I'm unable to really find a solution.  Here is my code for SessionFactoryUtil and my hibernate.cfg.xml.  Any pointers would be greatly appreciated.  </p>
  
  <pre><code>public class SessionFactoryUtil {
  
  private static SessionFactory sessionFactory;
  private static ServiceRegistry serviceRegistry;
  
  private static SessionFactory configureSessionFactory() 
          throws HibernateException {
  
      Configuration configuration = new Configuration();
      configuration.configure();
      serviceRegistry = new ServiceRegistryBuilder()
              .applySettings(configuration.getProperties())
              .buildServiceRegistry();
  
      sessionFactory = configuration.buildSessionFactory(serviceRegistry);
  
      return sessionFactory;
  }
  
  
  public static SessionFactory getInstance() {
      return configureSessionFactory();
      //return sessionFactory;
  }
  
  public Session getCurrentSession() {
      return sessionFactory.getCurrentSession();
  }
  
  public static void close() {
      if (sessionFactory != null) {
          sessionFactory.close();
          sessionFactory = null;
      }
  }
  
  }
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;xxxxxxxx&lt;/property&gt;
      &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://xxxxx.cvo0kkopzfhs.us-west-1.rds.amazonaws.com/homemoviezoo&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;xxxxx&lt;/property&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
      &lt;property name="log4jdbc.drivers"&gt;jdbc:log4jdbc:mysql://xxxxcvo0kkopzfhs.us-west-1.rds.amazonaws.com/homemoviezoo&lt;/property&gt;
      &lt;!-- configuration pool via c3p0--&gt;
              &lt;property name="c3p0.acquire_increment"&gt;1&lt;/property&gt;
              &lt;property name="c3p0.idle_test_period"&gt;800&lt;/property&gt; &lt;!-- seconds --&gt;
              &lt;property name="c3p0.max_size"&gt;20&lt;/property&gt;
              &lt;property name="c3p0.max_statements"&gt;20&lt;/property&gt;
              &lt;property name="c3p0.min_size"&gt;5&lt;/property&gt;
              &lt;property name="c3p0.timeout"&gt;1800&lt;/property&gt; &lt;!-- seconds --&gt;
              &lt;property name="c3p0.maxConnectionAge"&gt;1200&lt;/property&gt;
              &lt;property name="conneciton.provider_class"&gt;
                              org.hibernate.connection.C3P0ConnectionProvider&lt;/property&gt;
  
  
      &lt;property     name="transaction.factory_class"&gt;org.hibernate.transaction.JDBCTransactionFactory&lt;/property&gt;
      &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
      &lt;property name="hibernate.show_sql"&gt;true&lt;/property&gt;
      &lt;!--  &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt;--&gt;
      &lt;mapping class="com.local.shared.School"/&gt;
      &lt;mapping class="com.local.shared.SchoolVideo"/&gt;
      &lt;mapping class="com.local.shared.Category"/&gt;
      &lt;mapping class="com.local.shared.Administrator"/&gt;
  &lt;/session-factory&gt;
  
  
  
  
  &lt;/hibernate-configuration&gt;
  </code></pre>