title: hibernate buildSessionFactory ClassFormatError:
body: <p>ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/InheritanceType</p>
  
  <p>I got this error when try to build sessionFactory
  my hibernate.cfg.xml file :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="hibernate.bytecode.use_reflection_optimizer"&gt;false&lt;/property&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;mateusz&lt;/property&gt;
          &lt;property name="hibernate.connection.password"&gt;mateusz123&lt;/property&gt;
          &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/carpool&lt;/property&gt;
          &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
          &lt;mapping class="org.mathew.data.User"&gt;&lt;/mapping&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>my HibernateUtil class:</p>
  
  <pre><code>public class HibernateUtil {
  
      private static final SessionFactory sessionFactory = buildSessionFactory();
  
      private static SessionFactory buildSessionFactory() {
          try {
              // Create the SessionFactory from hibernate.cfg.xml
              return new AnnotationConfiguration().configure().buildSessionFactory();
  
          }
          catch (Throwable ex) {
              // Make sure you log the exception, as it might be swallowed
              System.err.println("Initial SessionFactory creation failed." + ex);
              throw new ExceptionInInitializerError(ex);
          }
      }
  
      public static SessionFactory getSessionFactory() {
          return sessionFactory;
      }
  
      public static void shutdown() {
          // Close caches and connection pools
          getSessionFactory().close();
      }
  
  }
  </code></pre>
  
  <p>StackTrace:</p>
  
  <pre><code>Exception in thread "main" java.lang.ExceptionInInitializerError
      at org.mathew.hibutil.HibernateUtil.buildSessionFactory(HibernateUtil.java:19)
      at org.mathew.hibutil.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:8)
      at org.mathew.mysql.MySqlQueries.&lt;init&gt;(MySqlQueries.java:16)
      at org.mathew.test.AppMain.main(AppMain.java:8)
  Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/InheritanceType
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
      at org.hibernate.cfg.InheritanceState.extractInheritanceType(InheritanceState.java:51)
      at org.hibernate.cfg.InheritanceState.&lt;init&gt;(InheritanceState.java:21)
      at org.hibernate.cfg.AnnotationBinder.buildInheritanceStates(AnnotationBinder.java:2146)
      at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:492)
      at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1319)
      at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
      at org.mathew.hibutil.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
      ... 3 more
  </code></pre>
  
  <p>My libraries:</p>
  
  <pre><code>cglib
  commons-collections
  commons-logging
  dom4j
  hibernate3
  hibernate-annotations
  hibernate-commons-annotations
  hibernate-core
  java-api-6.0
  javassist
  jta
  log4j
  mysql-connector-java
  persistence-api
  slf4j
  slf4j-log4j
  </code></pre>
  
  <p>I can't upload image :)</p>
  
  <p>I would be thankfull if anybody can help.
  THANKS! :)</p>