1 Reply Latest reply on May 4, 2007 12:02 PM by apfeuti

    IllegalAccessError with Hibernate Annotation

    apfeuti Newbie

      Hi

      If I try to build a SessionFactory for annotated classes

      AnnotationConfiguration cfg = new AnnotationConfiguration();
      cfg.addAnnotatedClass(mypackage.MyAnnotatedEntity.class);
       SessionFactory sessionFactory = cfg.buildSessionFactory();


      (or if I try with an xml-configuration instead the above code)

      I get always this error:

      java.lang.IllegalAccessError: tried to access method org.hibernate.cfg.Mappings.(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/Map;Ljava/util/Map;)V from class org.hibernate.cfg.ExtendedMappings
      at org.hibernate.cfg.ExtendedMappings.(ExtendedMappings.java:65)
      at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:175)
      at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:263)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)
      at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)

      I use the latest Hibernate and Hibernate-Annotations.
      I deployed the latest hibernate3.jar to /server/all/lib and
      hibernate-annotations.jar, hibernate-commons-annotations.jar, ejb3-persistence.jar to /server/all/farm.

      The same code works perfectly in a standalone-environment (no JBoss, just a VM for JUnit-Tests). So it cannot be a incompatibility between Hibernate and Hibernate-Annotations.

      Thanks for any help
      Andreas