Description
Description
I am facing this weird issue with Spring Boot v2.1.0.RC1 where application fails with following exception -
2018-10-23 17:00:14.010 [main] INFO org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory : Starting embedded database: url='jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false', username='sa'
2018-10-23 17:00:14.137 [main] INFO org.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-10-23 17:00:14.184 [main] INFO org.hibernate.Version : HHH000412: Hibernate Core {5.3.7.Final}
2018-10-23 17:00:14.184 [main] INFO org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-10-23 17:00:14.266 [main] INFO org.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2018-10-23 17:00:14.330 [main] INFO org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2018-10-23 17:00:14.522 [main] INFO org.hibernate.search.engine.Version : HSEARCH000034: Hibernate Search 5.10.4.Final
2018-10-23 17:00:14.729 [main] INFO org.hibernate.tool.schema.internal.SchemaCreatorImpl : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@4e9e0c6'
2018-10-23 17:00:14.841 [main] INFO org.hibernate.tool.schema.internal.SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
2018-10-23 17:00:14.841 [main] WARN org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.exception.SearchException: HSEARCH000139: Unable to instantiate FieldBridge for uid of class java.util.UUID
2018-10-23 17:00:14.841 [main] INFO org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory : Shutting down embedded database: url='jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false'
2018-10-23 17:00:14.841 [main] INFO org.apache.catalina.core.StandardService : Stopping service [Tomcat]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/C:/Users/Kedar/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar) to field java.io.ObjectStreamClass$Caches.localDescs
WARNING: Please consider reporting this to the maintainers of org.apache.catalina.loader.WebappClassLoaderBase
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-10-23 17:00:14.857 [main] INFO org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-10-23 17:00:14.937 [main] ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'com.locationguru.app.model.UUIDBridge' that could not be found.
Action:
Consider defining a bean of type 'com.locationguru.app.model.UUIDBridge' in your configuration.
Problem
Application fails to start with an exception asking for bean of a class which has nothing to do with Spring / Spring Boot i.e. com.locationguru.app.model.UUIDBridge
.
Analysis
Something broke in Spring Boot v2.1.0.RC1
which is conflicting with its Hibernate ORM Search version considering everything works as expected for Spring Boot v2.0.0.M4
and below.
I have managed to generate a small project to reproduce this issue. hibernate-search-issues.zip
Temporary Workaround
Annotating class com.locationguru.app.model.UUIDBridge
with @Component
seems to temporarily resolve this issue but not sure why Hibernate Search field bridge is needed to be a Spring bean ?
Problem Environment
Windows 10 (64 Bit)
OpenJDK 11 (but reproducible with Oracle JDK 8 as well)
Spring Boot v2.1.0.RC1
Working Environment
Windows 10 (64 Bit)
OpenJDK 11 or Oracle JDK 8
Spring Boot v2.1.0.M4 or below