title: Hibernate ClassNotFound Exception - jars not compatible?
body: <p>I have an Hibernate Project with the following Hibernate relevant dependencies:</p>
  
  <pre><code> &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;4.1.4.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Because this is a web app, we also have a dependency on the servlet api. --&gt;
      &lt;dependency&gt;
  &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
  &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
  &lt;version&gt;6.0.35&lt;/version&gt;
   &lt;/dependency&gt;
  
      &lt;!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
          &lt;version&gt;1.6.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Hibernate gives you a choice of bytecode providers between cglib and javassist --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javassist&lt;/groupId&gt;
          &lt;artifactId&gt;javassist&lt;/artifactId&gt;
          &lt;version&gt;3.12.1.GA&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>and the error is: </p>
  
  <pre><code> NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider
  </code></pre>
  
  <p>full stack trace:</p>
  
  <pre><code> Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider
   05.07.2012 15:51:47 com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
   SCHWERWIEGEND: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
   java.lang.ExceptionInInitializerError
  at com.bachelor.core.HibernateUtil.buildSessionFactory(HibernateUtil.java:27)
  at        com.bachelor.service.EstateResourceBean.postAndGetResponse(EstateResourceBean.java:420)
  at com.bachelor.service.EstateResourceBean.postEstate(EstateResourceBean.java:166)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
  at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
  at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
  at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
  at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
  at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
  at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
  at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1483)
  at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1414)
  at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363)
  at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353)
  at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)
  at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
  at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
  at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>I already tried it with hibernate core 4.1.4.Final. Doesnt work. My lib folder has hibernate-core-4.1.3.Final as well, and dom4j-1.6.1.jar.</p>
  
  <p>I got another Hibernate project and it works well with this dependencies setup. There is just an additional hsqldb.jar in my lib folder. Whats wrong?</p>