title: Unable to create requested service [org.hibernate.cache.spi.RegionFactory] - Hibernate 4.3.8
body: <p>I have started using Hibernate 4.3.8 and was trying out a basic program to insert and retrieve a user. Below are my files.</p>
  
  <p>hibernate.cfg.xml</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <pre><code>&lt;session-factory&gt;
  
      &lt;!-- Database connection settings --&gt;
      &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
      &lt;property name="connection.url"&gt;jdbc:mysql://localhost:3306/mywork&lt;/property&gt;
      &lt;property name="connection.username"&gt;****&lt;/property&gt;
      &lt;property name="connection.password"&gt;*****&lt;/property&gt;
  
      &lt;!-- JDBC connection pool (use the built-in) --&gt;
      &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
  
      &lt;!-- SQL dialect --&gt;
      &lt;property name="dialect"&gt;
          org.hibernate.dialect.MySQL5Dialect
      &lt;/property&gt;
  
      &lt;!-- Enable Hibernate's automatic session context management --&gt;
      &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
  
      &lt;property name="cache.use_query_cache"&gt;true&lt;/property&gt;
      &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
      &lt;property name="cache.use_structured_entries"&gt;true&lt;/property&gt;
  
      &lt;!-- Echo all executed SQL to stdout --&gt;
      &lt;property name="show_sql"&gt;true&lt;/property&gt;
      &lt;property name="hbm2ddl.auto"&gt;create&lt;/property&gt;
  
      &lt;mapping class="com.parvez.hibernate.model.User"/&gt;
  
  &lt;/session-factory&gt;
  </code></pre>
  
  <p></p>
  
  <p>Java Code
  HB2Test.java</p>
  
  <pre><code>package com.parvez.hibernate.model;
  
  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 HB2Test {
  
      private static SessionFactory sessionFactory;
      /**
       * @param args
       */
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          User myUser = new User();
          myUser.setUserId(1);
          myUser.setUserName("Superman");
  
          /*StandardServiceRegistryBuilder builder = new    StandardServiceRegistryBuilder();
  
          //create session factory
          Configuration configuration = new Configuration();
          SessionFactory sessionFactory = configuration.configure().
                      buildSessionFactory(builder.applySettings(configuration.getProperties()).build());
  
          Session session = sessionFactory.openSession();
       */
  
      Configuration configuration = new Configuration().configure("hibernate.cfg.xml");
  
          ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
              configuration.getProperties()).build();
  
          sessionFactory =     configuration.buildSessionFactory(serviceRegistry);
  
          Session session = sessionFactory.openSession();
          session.beginTransaction();
  
          session.save(myUser);
  
          session.getTransaction().commit();
          session.close();
      }
  
  }
  </code></pre>
  
  <p>The error that I get is </p>
  
  <pre><code>INFO: HHH000397: Using ASTQueryTranslatorFactory
  Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.RegionFactory]
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:261)
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
  at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:295)
  at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2444)
  at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2440)
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
  at com.parvez.hibernate.model.HB2Test.main(HB2Test.java:37)
  Caused by: org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.EhCacheRegionFactory]
  at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:101)
  at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:46)
  at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
  ... 7 more
  Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.cache.EhCacheRegionFactory] as strategy [org.hibernate.cache.spi.RegionFactory]
  at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:128)
  at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:87)
  ... 10 more
  </code></pre>
  
  <p>I have tried different ways of initializing the SessionFactory, but nothing seems to work. I am using Hibernate 4.3.8-Final</p>
  
  <p>Thanks in advance</p>