title: Deploy EAR in TomEE - org/hibernate/mapping/MappedSuperclass
body: <p>I am trying to deploy EAR in TomEE.
  Ear contains a WAR file and a JAR file.
  And inside the Jar file, under META-INF, I have the persistence.xml file.
  I added hibernate jars under Tomee/lib</p>
  
  <p>When I start the tomee, I am getting following exception.</p>
  
  <pre><code>org.apache.openejb.OpenEJBException: Creating application failed: C:\apache-tomee-1.7.4-webprofile-without\apps\cmsear: org/hibernate/mapping/MappedSuperclass
          at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:843)
          at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677)
          at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:568)
          at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:464)
          at org.apache.openejb.OpenEJB$Instance.&lt;init&gt;(OpenEJB.java:151)
          at org.apache.openejb.OpenEJB.init(OpenEJB.java:309)
          at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:256)
          at org.apache.tomee.catalina.ServerListener.install(ServerListener.java:167)
          at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:54)
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
          at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
          at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:394)
          at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
          at org.apache.catalina.startup.Catalina.load(Catalina.java:642)
          at org.apache.catalina.startup.Catalina.load(Catalina.java:667)
          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:498)
          at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:253)
          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:427)
  Caused by: java.lang.NoClassDefFoundError: org/hibernate/mapping/MappedSuperclass
          at org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:59)
          at org.hibernate.ejb.EntityManagerFactoryImpl.&lt;init&gt;(EntityManagerFactoryImpl.java:83)
          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:883)
          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
          at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable.call(EntityManagerFactoryCallable.java:64)
          at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:116)
          at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.&lt;init&gt;(ReloadableEntityManagerFactory.java:102)
          at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:154)
          at org.apache.openejb.assembler.classic.Assembler.loadPersistenceUnits(Assembler.java:982)
          at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:741)
          ... 20 more
  Caused by: java.lang.ClassNotFoundException: org.hibernate.mapping.MappedSuperclass
          at org.apache.openejb.util.classloader.URLClassLoaderFirst.loadClass(URLClassLoaderFirst.java:136)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          ... 30 more
  </code></pre>
  
  <p>I have tried configuring tomee and hibernate using the following link:
  <a href="http://tomee.apache.org/tomee-and-hibernate.html" rel="nofollow noreferrer">http://tomee.apache.org/tomee-and-hibernate.html</a></p>
  
  <p>Could anyone help me in fixing this exception?
  And please let me know if I need to provide any other information. Thanks.</p>
  
  <p>Edit 1: Removed the jars from the WEB-INF/lib folder. And now getting the following exception:</p>
  
  <pre><code>INFO: Named query checking : enabled
  Apr 24, 2018 11:29:31 AM org.hibernate.impl.SessionFactoryImpl &lt;init&gt;
  INFO: building session factory
  Apr 24, 2018 11:29:32 AM org.hibernate.impl.SessionFactoryObjectFactory addInstance
  INFO: Not binding factory to JNDI, no JNDI name configured
  Apr 24, 2018 11:29:32 AM org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory createDelegate
  INFO: PersistenceUnit(name=JPADB, provider=org.hibernate.ejb.HibernatePersistence) - provider time 2509ms
  Apr 24, 2018 11:29:32 AM org.apache.openejb.assembler.classic.Assembler destroyApplication
  INFO: Undeploying app: C:\apache-tomee-1.7.4-webprofile-without\apps\cmsear
  Apr 24, 2018 11:29:32 AM org.apache.openejb.assembler.classic.Assembler buildContainerSystem
  SEVERE: Application could not be deployed:  C:\apache-tomee-1.7.4-webprofile-without\apps\cmsear
  org.apache.openejb.OpenEJBException: Creating application failed: C:\apache-tomee-1.7.4-webprofile-without\apps\cmsear: org/hibernate/mapping/MappedSuperclass
          at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:843)
          at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677)
          at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:568)
          at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:464)
          at org.apache.openejb.OpenEJB$Instance.&lt;init&gt;(OpenEJB.java:151)
          at org.apache.openejb.OpenEJB.init(OpenEJB.java:309)
          at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:256)
          at org.apache.tomee.catalina.ServerListener.install(ServerListener.java:167)
          at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:54)
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
          at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
          at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:394)
          at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
          at org.apache.catalina.startup.Catalina.load(Catalina.java:642)
          at org.apache.catalina.startup.Catalina.load(Catalina.java:667)
          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:498)
          at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:253)
          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:427)
  Caused by: java.lang.NoClassDefFoundError: org/hibernate/mapping/MappedSuperclass
  </code></pre>
  
  <p>EDIT 2 :
  Following are the jars that I have inside my tomee/lib :</p>
  
  <pre><code>hibernate-annotations-3.5.0.Final.jar
  hibernate-commons-annotations-5.0.1.Final.jar
  hibernate-core-3.5.0-Final.jar
  hibernate-entitymanager-3.5.0-Final.jar
  hibernate-jpa-2.1-api-1.0.0.Final.jar
  hibernate-validator-4.2.0.Final.jar
  hibernate-validator-annotation-processor-4.2.0.Final.jar
  </code></pre>
  
  <p>Edit 3 : Updated hibernate jars inside tomee/lib. Now the folder contains the following hibernate related jars.</p>
  
  <pre><code>hibernate-commons-annotations-5.0.1.Final.jar
  hibernate-core-5.0.12-Final.jar
  hibernate-entitymanager-5.0.12-Final.jar
  hibernate-jpa-2.1-api-1.0.0.Final.jar
  hibernate-validator-4.2.0.Final.jar
  hibernate-validator-annotation-processor-4.2.0.Final.jar
  jboss-logging-3.3.0.Final.jar
  </code></pre>
  
  <p>Edit 4 : My application.xml looks as follows:</p>
  
  <pre><code>  &lt;module&gt;
      &lt;web&gt;
        &lt;web-uri&gt;abc.war&lt;/web-uri&gt;
        &lt;context-root&gt;abc&lt;/context-root&gt;
      &lt;/web&gt;
    &lt;/module&gt;
    &lt;module&gt;
      &lt;ejb&gt;defEJB.jar&lt;/ejb&gt;
    &lt;/module&gt;
  </code></pre>