Grails 3.2.1 WAR fails to start with missing org.hibernate.boot.registry.selector.StrategyRegistrationProvider

423 views Asked by At

I have a project that works fine with Grails 3.2.0 when runs as assembled WAR, but when I try to upgrade to any version above that it fails with the error below.

It works fine on all 3.2.x versions running under grails run-app but when I assemble the war and run it on 3.2.1, 3.2.2 and 3.2.3, I get the error.

Other searches suggest it has something to do with Infinispan but I'm not using Infinispan. I tried adding the hibernate-infinispan:5.1.2.Final jar to project but still didn't work.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.util.ServiceConfigurationError: org.hibernate.boot.registry.selector.StrategyRegistrationProvider: Error reading configuration file
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
    ... 70 common frames omitted
Caused by: java.util.ServiceConfigurationError: org.hibernate.boot.registry.selector.StrategyRegistrationProvider: Error reading configuration file
    at java.util.ServiceLoader.fail(ServiceLoader.java:232)
    at java.util.ServiceLoader.parse(ServiceLoader.java:309)
    at java.util.ServiceLoader.access$200(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:357)
    at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
    at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:340)
    at org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder.buildSelector(StrategySelectorBuilder.java:162)
    at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:222)
    at org.hibernate.cfg.Configuration.<init>(Configuration.java:119)
    at org.grails.orm.hibernate.cfg.HibernateMappingContextConfiguration.<init>(HibernateMappingContextConfiguration.java:56)
    at org.grails.orm.hibernate.connections.HibernateConnectionSourceFactory.buildConfiguration(HibernateConnectionSourceFactory.java:110)
    at org.grails.orm.hibernate.connections.HibernateConnectionSourceFactory.create(HibernateConnectionSourceFactory.java:85)
    at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:38)
    at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:22)
    at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:64)
    at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:52)
    at org.grails.datastore.mapping.core.connections.ConnectionSourcesInitializer.create(ConnectionSourcesInitializer.groovy:24)
    at org.grails.orm.hibernate.HibernateDatastore.<init>(HibernateDatastore.java:206)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
    ... 72 common frames omitted
Caused by: java.io.FileNotFoundException: JAR entry !/META-INF/services/org.hibernate.boot.registry.selector.StrategyRegistrationProvider not found in /tmp/jar_cache5503433917943275700.tmp
    at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:142)
1

There are 1 answers

0
gangmax On

manually downgrading to tomcat 8.5.5 (for now) fixed the problem for me.

// build.gradle
ext {
    set "tomcat.version", "8.5.5"
}

From here