title: EntityManager not injected using @PersistenceContext in JBoss 4.3 (EJB3 and Hibernate 4.3.9 Final)
body: <p>I'm trying to create an extended PersistenceContext by having the container inject the EntityManager into a Stateful EJB. With JBoss 4.3.0.GA_06 and Hibernate 4.3.9.Final, the EntityManager is not injected despite annotating the EJB field with @PersistenceContext.</p>
  
  <p>EJB:</p>
  
  <pre><code>package com.foo.bar.example;
  
  import org.jboss.annotation.ejb.LocalBinding;
  
  import javax.ejb.Stateful;
  import javax.persistence.EntityManager;
  import javax.persistence.PersistenceContext;
  import javax.persistence.PersistenceContextType;
  import javax.persistence.SynchronizationType;
  
  @Stateful
  @LocalBinding(jndiBinding = "MyEJB/EntityManagerBean")
  public class EntityManagerHolderBean implements EntityManagerHolderLocal {
      @PersistenceContext(type = PersistenceContextType.EXTENDED, synchronization = SynchronizationType.UNSYNCHRONIZED)
      protected EntityManager em;
  
      @Override
      public EntityManager getEntityManager() {
          return em;
      }
  }
  </code></pre>
  
  <p>EJB interface:</p>
  
  <pre><code>package com.foo.bar.example;
  
  import org.jboss.annotation.ejb.Local;    
  import javax.persistence.EntityManager;
  
  @Local
  public interface EntityManagerHolderLocal {    
      EntityManager getEntityManager();
  }
  </code></pre>
  
  <p>Persistence.xml:</p>
  
  <pre><code>&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
               version="2.0"&gt;
    &lt;persistence-unit name="examplePersistenceUnit"&gt;
      &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
      &lt;jta-data-source&gt;java:/DefaultDS&lt;/jta-data-source&gt;
      &lt;properties&gt;
        &lt;!-- Scan for annotated classes and Hibernate mapping XML files from this JAR --&gt;
        &lt;property name="hibernate.archive.autodetection" value="class, hbm" /&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Deploying the EAR containing the EJB causes JBoss to log the following stacktrace to server.log; I presume that this explains why the injection does not work:  </p>
  
  <pre><code>2015-05-08 14:46:44,200 INFO  [org.jboss.ejb3.JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.entity.PersistenceUnitDeployment
  2015-05-08 14:46:44,203 INFO  [org.jboss.ejb3.JmxKernelAbstraction] installing MBean: persistence.units:ear=earmodule-1.0-SNAPSHOT.ear,jar=ejb-1.0-SNAPSHOT.jar,unitName=examplePersistenceUnit with dependencies:
  2015-05-08 14:46:44,203 INFO  [org.jboss.ejb3.JmxKernelAbstraction]     jboss.jca:name=DefaultDS,service=DataSourceBinding
  2015-05-08 14:46:44,205 INFO  [org.jboss.ejb3.entity.PersistenceUnitDeployment] Starting persistence unit persistence.units:ear=earmodule-1.0-SNAPSHOT.ear,jar=ejb-1.0-SNAPSHOT.jar,unitName=examplePersistenceUnit
  2015-05-08 14:46:44,234 WARN  [org.jboss.system.ServiceController] Problem starting service persistence.units:ear=earmodule-1.0-SNAPSHOT.ear,jar=ejb-1.0-SNAPSHOT.jar,unitName=examplePersistenceUnit
  java.lang.ClassCastException: org.hibernate.jpa.HibernatePersistenceProvider cannot be cast to javax.persistence.spi.PersistenceProvider
      at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:245)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at com.sun.proxy.$Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at com.sun.proxy.$Proxy55.start(Unknown Source)
      at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:120)
      at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:628)
      at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:352)
      at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:83)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at com.sun.proxy.$Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at com.sun.proxy.$Proxy33.start(Unknown Source)
      at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:525)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
      at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
      at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
      at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
      at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at com.sun.proxy.$Proxy34.start(Unknown Source)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at com.sun.proxy.$Proxy9.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at com.sun.proxy.$Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at com.sun.proxy.$Proxy4.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at com.sun.proxy.$Proxy5.deploy(Unknown Source)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
      at org.jboss.Main.boot(Main.java:200)
      at org.jboss.Main$1.run(Main.java:513)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Can JBoss 4.3.0.GA_06 be set up to inject the EntityManager, or is the only alternative to switch to a more recent JBoss version? Further details regarding the EAR structure are in a <a href="https://github.com/lauriharpf/jboss-4-3-jpa-ejb" rel="nofollow">Maven-based failing demonstrator project</a> at GitHub.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Attempting to replace the JBoss Hibernate implementation with Hibernate 4.3.9.Final does not seem to work, at least out of the box. If I </p>
  
  <ol>
  <li>Remove Hibernate-related JARs (hibernate3.jar, hibernate-annotations.jar, hibernate-commons-annotations.jar, hibernate-entitymanager.jar, hibernate-validator.jar) from the server lib directory (e.g. default/lib)</li>
  <li>Copy the EAR JARs into the sever lib directory</li>
  <li>Start JBoss</li>
  </ol>
  
  <p>Then deployment still fails, but with a different error:</p>
  
  <pre><code>2015-05-19 08:20:47,996 WARN  [org.jboss.system.ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=ejb-1.0-SNAPSHOT.jar
  java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
  at org.hibernate.internal.util.xml.DTDEntityResolver.&lt;clinit&gt;(DTDEntityResolver.java:60)
  at org.jboss.ejb3.Ejb3Deployment.initializePersistenceUnits(Ejb3Deployment.java:536)
  at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:330)
  at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:74)
  at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
  at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
  at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
  at com.sun.proxy.$Proxy0.create(Unknown Source)
  at org.jboss.system.ServiceController.create(ServiceController.java:330)
  at org.jboss.system.ServiceController.create(ServiceController.java:273)
  at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  at com.sun.proxy.$Proxy33.create(Unknown Source)
  at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:505)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
  at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
  at org.jboss.wsf.container.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:76)
  at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
  at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  at com.sun.proxy.$Proxy34.create(Unknown Source)
  at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
  at org.jboss.deployment.MainDeployer.create(MainDeployer.java:959)
  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
  at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  at com.sun.proxy.$Proxy9.deploy(Unknown Source)
  at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
  at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
  at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
  at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
  at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
  at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
  at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
  at com.sun.proxy.$Proxy0.start(Unknown Source)
  at org.jboss.system.ServiceController.start(ServiceController.java:417)
  at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  at com.sun.proxy.$Proxy4.start(Unknown Source)
  at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
  at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  at com.sun.proxy.$Proxy5.deploy(Unknown Source)
  at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
  at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
  at org.jboss.Main.boot(Main.java:200)
  at org.jboss.Main$1.run(Main.java:513)
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>This seems to be an incompatibility between the org.jboss.logging.Logger implementation hibernate-core depends on and the org.jboss.logging.Logger class in the shared libs of my JBoss installation; my jboss-eap-4.3.0\jboss-as\lib directory contains a jboss-common.jar, which holds an org.jboss.logging.Logger without a getMessageLogger method.</p>
  
  <p>After the implementation change, contents of my JBoss lib directories are as follows:</p>
  
  <pre><code>jboss-eap-4.3.0\jboss-as\lib:
  
  47 469 commons-codec.jar
  214 793 commons-httpclient.jar
  55 566 commons-logging.jar
  256 694 concurrent.jar
  &lt;DIR&gt;          endorsed
  15 866 getopt.jar
  406 583 jboss-common.jar
  879 986 jboss-jmx.jar
  267 603 jboss-system.jar
  376 451 jboss-xml-binding.jar
  128 413 log4j-boot.jar
  175 202 webdavlib.jar
  
  jboss-eap-4.3.0\jboss-as\lib\server\default\lib:
  
  70 283 activation.jar
  445 288 antlr-2.7.7.jar
  355 310 antlr.jar
  17 260 asm-attrs.jar
  26 778 asm.jar
  4 951 autonumber-plugin.jar
  513 252 bcel.jar
  21 300 bindingservice-plugin.jar
  167 699 bsf.jar
  12 139 bsh-deployer.jar
  235 516 bsh.jar
  286 184 cglib.jar
  47 469 commons-codec.jar
  558 375 commons-collections.jar
  214 793 commons-httpclient.jar
  55 566 commons-logging.jar
  313 898 dom4j-1.6.1.jar
  313 136 dom4j.jar
  52 188 ejb3-persistence.jar
  28 039 el-api.jar
  75 324 hibernate-commons-annotations-4.0.5.Final.jar
  5 277 940 hibernate-core-4.3.9.Final.jar
  647 565 hibernate-entitymanager-4.3.9.Final.jar
  113 371 hibernate-jpa-2.1-api-1.0.0.Final.jar
  8 748 hsqldb-plugin.jar
  705 554 hsqldb.jar
  76 551 jandex-1.1.0.Final.jar
  714 195 javassist-3.18.1-GA.jar
  599 322 javassist.jar
  226 490 jaxen.jar
  725 792 jboss-cache-jdk50.jar
  87 170 jboss-common-jdbc-wrapper.jar
  20 393 jboss-ejb3x.jar
  14 196 jboss-hibernate.jar
  423 715 jboss-j2ee.jar
  29 390 jboss-jaxrpc.jar
  63 836 jboss-jaxws.jar
  200 395 jboss-jca.jar
  14 227 jboss-jsr77.jar
  65 053 jboss-jsr88.jar
  57 183 jboss-logging-3.1.3.GA.jar
  11 558 jboss-logging-annotations-1.2.0.Beta1.jar
  152 338 jboss-management.jar
  583 242 jboss-messaging-client.jar
  1 148 573 jboss-messaging.jar
  56 310 jboss-monitoring.jar
  8 385 jboss-remoting-int.jar
  924 915 jboss-remoting.jar
  26 744 jboss-saaj.jar
  125 858 jboss-serialization.jar
  46 984 jboss-srp.jar
  27 717 jboss-transaction-api_1.2_spec-1.0.0.Final.jar
  53 284 jboss-transaction.jar
  90 744 jboss-vfs.jar
  2 139 468 jboss.jar
  31 271 jbossjta-integration.jar
  552 165 jbossjta.jar
  317 324 jbosssx.jar
  65 399 jbossts-common.jar
  55 112 jbossws-common.jar
  69 093 jbossws-framework.jar
  77 153 jbossws-jboss42.jar
  95 812 jbossws-spi.jar
  33 310 jmx-adaptor-plugin.jar
  54 286 jnpserver.jar
  82 157 joesnmp.jar
  81 902 jsp-api.jar
  15 151 log4j-snmp-appender.jar
  355 760 log4j.jar
  5 475 mail-plugin.jar
  415 743 mail.jar
  2 714 016 ojdbc6.jar
  8 827 properties-plugin.jar
  397 928 quartz-all.jar
  3 546 scheduler-plugin-example.jar
  46 045 scheduler-plugin.jar
  88 151 servlet-api.jar
  109 318 xml-apis-1.0.b2.jar
  2 666 xmlentitymgr.jar
  </code></pre>