title: NoSuchMethodError: org.jboss.logging.Logger.debugf
body: <p>I'm trying to make a stack Spring + Spring Data + Log4J2 work.
  Unfortunately, when deploying the artefact on My Glassfish 4.1 Server, the following error occurs :</p>
  
  <pre><code>
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class com.canal.config.spring.ContextConfig: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.persistence.EntityManagerFactory com.canal.config.spring.ContextConfig.entityManagerFactory()] threw exception; nested exception is java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:601)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1113)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1008)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:505)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
      at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:535)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489)
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
      at javax.servlet.GenericServlet.init(GenericServlet.java:244)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1382)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5704)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5946)
      at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2286)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
      at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
      at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
  Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.persistence.EntityManagerFactory com.canal.config.spring.ContextConfig.entityManagerFactory()] threw exception; nested exception is java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:188)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:590)
      ... 69 more
  Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
      at org.hibernate.internal.NamedQueryRepository.checkNamedQueries(NamedQueryRepository.java:149)
      at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:764)
      at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:495)
      at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802)
      at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
      at com.canal.config.spring.ContextConfig.entityManagerFactory(ContextConfig.java:52)
      at com.canal.config.spring.ContextConfig$$EnhancerBySpringCGLIB$$db0b8696.CGLIB$entityManagerFactory$0()
      at com.canal.config.spring.ContextConfig$$EnhancerBySpringCGLIB$$db0b8696$$FastClassBySpringCGLIB$$bca83b68.invoke()
      at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
      at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
      at com.canal.config.spring.ContextConfig$$EnhancerBySpringCGLIB$$db0b8696.entityManagerFactory()
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:166)
      ... 70 more
  </code></pre>
  
  <p>My pom.xml is : </p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.springapp&lt;/groupId&gt;
      &lt;artifactId&gt;advance&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;advance&lt;/name&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;springframework.version&gt;4.2.1.RELEASE&lt;/springframework.version&gt;
          &lt;log4j.version&gt;2.4&lt;/log4j.version&gt;
          &lt;javaee.version&gt;7.0&lt;/javaee.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;!-- Utilise Log4J à la place du logger par défaut --&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;!-- Utilise Log4J à la place du logger par défaut --&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&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;${springframework.version}&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;!-- Utilise Log4J à la place du logger par défaut --&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Log4J2 Dependance --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
              &lt;version&gt;${log4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
              &lt;version&gt;2.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Bridge Log Spring vers Log4J --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j-jcl&lt;/artifactId&gt;
              &lt;version&gt;${log4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;3.2.8.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
              &lt;version&gt;3.2.8.RELEASE&lt;/version&gt;
          &lt;/dependency&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;1.9.0.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax&lt;/groupId&gt;
              &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
              &lt;version&gt;${javaee.version}&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;5.0.1.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;${artifactId}&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${java.version}&lt;/source&gt;
                      &lt;target&gt;${java.version}&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Does anyone have a clue ?</p>