1 Reply Latest reply on Aug 13, 2016 8:38 AM by Saria ESSID

    javax.persistence.Table.indexes()[Ljavax/persistence/Index

    Saria ESSID Novice

      My project works fine with Tomcat 7, Tomcat 8, WildFly 8 and WildFly 10. It works with: JSF : 2.0 Hibernate : 4.3.5 JDK : 1.7 But, there's a problem with JBoss 7.1. In fact, the following error is displayed. Could you please help me solving this exception.

       

      17:53:56,517 INFO  [org.hibernate.dialect.Dialect] (http-localhost-127.0.0.1-8080-1) HHH000400: Using dialect: org.hibernate.dialect.SQLServer2005Dialect
      17:53:56,626 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/HelloJPAHibernate].[Faces Servlet]] (http-localhost-127.0.0.1-8080-1) Servlet.service() for servlet Faces Servlet threw exception: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
       at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:936) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
       at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:824) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
       at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3788) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
       at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3742) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
       at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
       at com.esprit.dao.EntityDao.getSessionFactory(EntityDao.java:48) [classes:]
       at com.esprit.dao.EntityDao.openCurrentSession(EntityDao.java:25) [classes:]
       at com.esprit.dao.EntityService.findAllPersons(EntityService.java:86) [classes:]
       at com.esprit.crud.dynamic.DataModelBeanD.init(DataModelBeanD.java:37) [classes:]
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_55]
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_55]
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_55]
      

       

      Thanks in advance.

        • 1. Re: javax.persistence.Table.indexes()[Ljavax/persistence/Index
          Saria ESSID Novice

          Hello, I made Hibernate 4.2.21 instead of Hibernate 4.3.5. Then I re-create the method getSessionFactory() like bellow:

           

            private static SessionFactory getSessionFactory()
            {
                if (sessionFactory == null) 
                {
                   Configuration configuration = new Configuration().configure();
                   ServiceRegistryBuilder registry = new ServiceRegistryBuilder();
                   registry.applySettings(configuration.getProperties());
                   ServiceRegistry serviceRegistry = registry.buildServiceRegistry();
                   sessionFactory = configuration.buildSessionFactory(serviceRegistry);           
                }
                return sessionFactory;
            }
          

           

          So my problem is solved now.