title: Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;II)V - in Spring REST example
body: <p>I am working on <strong>Spring RESTFul resource</strong> example. I've taken a reference from the link : <a href="https://github.com/habuma/rest-books" rel="nofollow">https://github.com/habuma/rest-books</a>. In this example I only updated dependencies in the <code>pom.xml</code> shown below and rename the package name to make it more meaningful name. When I was trying to deploy the code on tomcat <code>apache-tomcat-8.0.36</code>. I see the following error and really exhausted in solving this error. Please guide.</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localContainerEntityManagerFactoryBean' defined in com.habuma.books.config.JpaConfiguration: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;II)V
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;II)V
      at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:94)
      at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:234)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:208)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:848)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:876)
      at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:338)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:373)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:362)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
      ... 21 common frames omitted
  Sep 06, 2016 12:12:11 AM org.apache.catalina.core.StandardContext listenerStart
  SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  </code></pre>
  
  <p>The updated <strong>pom.xml</strong></p>
  
  <pre><code>&lt;properties&gt;
          &lt;!-- General --&gt;
          &lt;java-version&gt;1.8&lt;/java-version&gt;
  
          &lt;!-- Spring --&gt;
          &lt;org.springframework-version&gt;4.3.1.RELEASE&lt;/org.springframework-version&gt;
  
          &lt;!-- HATEOAS --&gt;
          &lt;spring-hateoas-version&gt;0.21.0.RELEASE&lt;/spring-hateoas-version&gt;
  
          &lt;!-- Hibernate Entity Manager --&gt;
          &lt;hibernate-entitymanager-version&gt;5.1.0.Final&lt;/hibernate-entitymanager-version&gt;
  
          &lt;!-- Spring Data JPA --&gt;
          &lt;spring-data-jpa-version&gt;1.9.0.RELEASE&lt;/spring-data-jpa-version&gt;
  
          &lt;!-- Validation API --&gt;
          &lt;validation-api-version&gt;1.1.0.Final&lt;/validation-api-version&gt;
  
          &lt;!-- Hibernate Validator --&gt;
          &lt;hibernate-validator-version&gt;5.1.0.Final&lt;/hibernate-validator-version&gt;
  
          &lt;!-- Jackson --&gt;
          &lt;jackson.version&gt;2.8.2&lt;/jackson.version&gt;
  
          &lt;!-- AspectJ --&gt;
          &lt;org.aspectj-version&gt;1.8.9&lt;/org.aspectj-version&gt;
          &lt;logback.version&gt;1.1.7&lt;/logback.version&gt;
          &lt;jcl-over-slf4j.version&gt;1.7.21&lt;/jcl-over-slf4j.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;!-- Spring Web, WebMVC --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring OXM --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring HATEOAS --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.hateoas&lt;/groupId&gt;
              &lt;artifactId&gt;spring-hateoas&lt;/artifactId&gt;
              &lt;version&gt;${spring-hateoas-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring Data JPA --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
              &lt;version&gt;${spring-data-jpa-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Hibernate Validator --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;${hibernate-validator-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Hibernate Entity Manager --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;${hibernate-entitymanager-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
              &lt;version&gt;${validation-api-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;version&gt;1.3.156&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
              &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
              &lt;version&gt;1.2.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- AspectJ --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
              &lt;version&gt;${org.aspectj-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Jackson Core, DataBind, Annotations --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- logging, slf4j --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
              &lt;version&gt;${jcl-over-slf4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
              &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
              &lt;version&gt;${logback.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- @Inject --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.inject&lt;/groupId&gt;
              &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
              &lt;version&gt;1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Servlet --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
              &lt;artifactId&gt;jsp-api&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Test --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  </code></pre>
  
  <p>The other files of the code are unchanged. Please guide.
  <strong>JpaConfiguration.java</strong></p>
  
  <pre><code>@Configuration
  public class JpaConfiguration {
  
      @Value("#{dataSource}")
      private javax.sql.DataSource dataSource;
  
      @Bean
      public Map&lt;String, Object&gt; jpaProperties() {
          Map&lt;String, Object&gt; props = new HashMap&lt;String, Object&gt;();
          props.put("hibernate.dialect", H2Dialect.class.getName());
      //  props.put("hibernate.cache.provider_class", HashtableCacheProvider.class.getName());
          return props;
      }
  
      @Bean
      public JpaVendorAdapter jpaVendorAdapter() {
          HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
          hibernateJpaVendorAdapter.setShowSql(false);
          hibernateJpaVendorAdapter.setGenerateDdl(true);
          hibernateJpaVendorAdapter.setDatabase(Database.H2);
          return hibernateJpaVendorAdapter;
      }
  
      @Bean
      public PlatformTransactionManager transactionManager() {
          return new JpaTransactionManager( localContainerEntityManagerFactoryBean().getObject() );
      }
  
      @Bean
      public LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean() {
          LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
          lef.setDataSource(this.dataSource);
          lef.setJpaPropertyMap(this.jpaProperties());
          lef.setJpaVendorAdapter(this.jpaVendorAdapter());
          return lef;
      }
  }
  </code></pre>