title: NoSuchMethodError: buildSessionFactory using Hibernate 5.1.0 and c3p0
body: <p>I'm trying to run a hibernate application on tomcat 7.0.57 using c3p0 connection pool management. It is not possible to build a sessionFactory due to a NoSuchMethodError.</p>
  
  <p>Here is my pom.xml:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
      &lt;version&gt;5.1.0.Final&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-c3p0&lt;/artifactId&gt;
      &lt;version&gt;5.1.0.Final&lt;/version&gt;
  &lt;/dependency&gt;   
  &lt;dependency&gt;
      &lt;groupId&gt;com.mchange&lt;/groupId&gt;
      &lt;artifactId&gt;c3p0&lt;/artifactId&gt;
      &lt;version&gt;0.9.5.2&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>My hibernate.cfg.xml:</p>
  
  <pre><code>&lt;property name="hibernate.connection.provider_class"&gt;org.hibernate.c3p0.internal.C3P0ConnectionProvider&lt;/property&gt;
  &lt;property name="hibernate.c3p0.min_size"&gt;10&lt;/property&gt;
  &lt;property name="hibernate.c3p0.max_size"&gt;20&lt;/property&gt;
  &lt;property name="hibernate.c3p0.acquire_increment"&gt;1&lt;/property&gt;
  &lt;property name="hibernate.c3p0.idle_test_period"&gt;300&lt;/property&gt;
  &lt;property name="hibernate.c3p0.max_statements"&gt;50&lt;/property&gt;
  &lt;property name="hibernate.c3p0.timeout"&gt;180&lt;/property&gt;
  </code></pre>
  
  <p>When I'm restarting the Tomcat I'm getting this exception:</p>
  
  <pre><code>java.lang.NoSuchMethodError: org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.extractIsolation(Ljava/util/Map;)Ljava/lang/Integer;
  at org.hibernate.c3p0.internal.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:200)
  at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
  at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
  at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
  at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
  at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885)
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)
  at urlarchiv.db.HibernateUtil.createSessionFactory(HibernateUtil.java:27)
  at urlarchiv.db.UrlManager.&lt;init&gt;(UrlManager.java:18)
  at urlarchiv.reader.XmlReader.readXml(XmlReader.java:99)
  at urlarchiv.reader.XmlReader.readXml(XmlReader.java:80)
  at urlarchiv.servlets.UrlArchivingServlet.init(UrlArchivingServlet.java:118)
  at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
  at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
  at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081)
  at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1877)
  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
  at java.util.concurrent.FutureTask.run(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>The exception is thrown here (buildSessionFactory):</p>
  
  <pre><code>public class HibernateUtil {
  
  private static SessionFactory sessionFactory;
  private static ServiceRegistry serviceRegistry;
  
  public static SessionFactory createSessionFactory() {
      Configuration configuration = new Configuration();
  
      try {
          configuration.configure();
      } catch (HibernateException e) {
          configuration.configure("/META-INF/hibernate.cfg.xml");
      }
  
      serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
              configuration.getProperties()).build();
      sessionFactory = configuration.buildSessionFactory(serviceRegistry);
  
      return sessionFactory;
  }
  </code></pre>
  
  <p>EDIT:
  My maven dependency tree</p>
  
  <pre><code>[INFO] +- junit:junit:jar:4.12:compile
  [INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
  [INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
  [INFO] +- org.hibernate:hibernate-entitymanager:jar:5.1.0.Final:compile
  [INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
  [INFO] |  +- org.hibernate:hibernate-core:jar:5.1.0.Final:compile
  [INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
  [INFO] |  |  +- org.jboss:jandex:jar:2.0.0.Final:compile
  [INFO] |  |  \- com.fasterxml:classmate:jar:1.3.0:compile
  [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
  [INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
  [INFO] |  +- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
  [INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
  [INFO] |  +- org.javassist:javassist:jar:3.20.0-GA:compile
  [INFO] |  \- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
  [INFO] +- org.hibernate:hibernate-c3p0:jar:5.1.0.Final:compile
  [INFO] +- com.mchange:c3p0:jar:0.9.5.2:compile
  [INFO] |  \- com.mchange:mchange-commons-java:jar:0.2.11:compile
  [INFO] +- commons-io:commons-io:jar:2.4:compile
  </code></pre>