We're updating the issue view to help you get more done. 

NoClassDefFoundError when using Hibernate ORM 4.3.0

Description

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 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+.

Environment

None

Status

Assignee

Sanne Grinovero

Reporter

Nick Williams

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Fix versions

Affects versions

4.4.0.Alpha1

Priority

Blocker