Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-1386

NoClassDefFoundError when using Hibernate ORM 4.3.0

    Details

    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

      Description

      Hibernate Search is completely unusable with Hibernate Core 4.3.0. I get the following error:

      java.lang.NoClassDefFoundError: org/hibernate/service/spi/BasicServiceInitiator
      	at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0-ea]
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:752) ~[?:1.8.0-ea]
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0-ea]
      	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2627) ~[catalina.jar:8.0.0-RC1]
      	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:989) ~[catalina.jar:8.0.0-RC1]
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1432) ~[catalina.jar:8.0.0-RC1]
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1310) ~[catalina.jar:8.0.0-RC1]
      	at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:218) ~[hibernate-core-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[?:1.8.0-ea]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[?:1.8.0-ea]
      	at java.lang.Class.forName0(Native Method) ~[?:1.8.0-ea]
      	at java.lang.Class.forName(Class.java:339) ~[?:1.8.0-ea]
      	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370) ~[?:1.8.0-ea]
      	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) ~[?:1.8.0-ea]
      	at java.util.ServiceLoader$1.next(ServiceLoader.java:474) ~[?:1.8.0-ea]
      	at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:322) ~[hibernate-core-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:55) ~[hibernate-core-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:215) ~[hibernate-core-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:518) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:206) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:186) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:43) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:55) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:142) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:293) ~[spring-orm-4.0.0.M2.jar:4.0.0.M2]
      	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:317) ~[spring-orm-4.0.0.M2.jar:4.0.0.M2]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1566) ~[spring-beans-4.0.0.M2.jar:4.0.0.M2]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1503) ~[spring-beans-4.0.0.M2.jar:4.0.0.M2]
      	... 55 more
      Caused by: java.lang.ClassNotFoundException: org.hibernate.service.spi.BasicServiceInitiator
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1465) ~[catalina.jar:8.0.0-RC1]
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1310) ~[catalina.jar:8.0.0-RC1]
      	at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0-ea]
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:752) ~[?:1.8.0-ea]
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0-ea]
      	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2627) ~[catalina.jar:8.0.0-RC1]
      	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:989) ~[catalina.jar:8.0.0-RC1]
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1432) ~[catalina.jar:8.0.0-RC1]
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1310) ~[catalina.jar:8.0.0-RC1]
      	at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:218) ~[hibernate-core-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[?:1.8.0-ea]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[?:1.8.0-ea]
      	at java.lang.Class.forName0(Native Method) ~[?:1.8.0-ea]
      	at java.lang.Class.forName(Class.java:339) ~[?:1.8.0-ea]
      	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370) ~[?:1.8.0-ea]
      	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) ~[?:1.8.0-ea]
      	at java.util.ServiceLoader$1.next(ServiceLoader.java:474) ~[?:1.8.0-ea]
      	at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:322) ~[hibernate-core-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:55) ~[hibernate-core-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:215) ~[hibernate-core-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:518) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:206) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:186) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:43) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:55) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:142) ~[hibernate-entitymanager-4.3.0.Beta3.jar:4.3.0.Beta3]
      	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:293) ~[spring-orm-4.0.0.M2.jar:4.0.0.M2]
      	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:317) ~[spring-orm-4.0.0.M2.jar:4.0.0.M2]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1566) ~[spring-beans-4.0.0.M2.jar:4.0.0.M2]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1503) ~[spring-beans-4.0.0.M2.jar:4.0.0.M2]
      	... 55 more

      This is because Hibernate Core 4.3 made the breaking change of moving org.hibernate.service.spi.BasicServiceInitiator to org.hibernate.boot.registry.StandardServiceInitiator.

      This is kind of a HUGE problem, and I'm surprised nobody has noticed it yet. I'm literally stuck. I can't go anywhere with Hibernate Search now, because I need new features in JPA 2.1 that only Hibernate 4.3 provides.

      Unfortunately, I only see two ways that this can be fixed:

      1. Revert the change in Hibernate Core (Why was such a huge breaking change made in a minor version, anyway? This class is used all over Hibernate OGM as well) in which case this bug needs to be moved to the Hibernate Core project.
      2. Make Hibernate Search 4.4 work only with Hibernate Core 4.3+.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                sanne Sanne Grinovero
                Reporter:
                beamerblvd Nick Williams
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: