Closed jeanlazarou closed 2 years ago
Hi, not sure if we tried, could you please provide a reproducer project with the elements described above?
I can reproduce the 100% exact same console output by only adding
`
<artifactId>hibernate-envers</artifactId>
</dependency>
` to a minimal maven project including -spring-boot-starter -spring-boot-starter-data-jpa -spring-native -mysql-connector-java
I also compiled with mvn spring-boot:build-image -DSkipTests
Similar bug was reported here and i gave up debugging until hibernate entity listening is fixed in future versions
Here is a project, as I described it does nothing, you only need to compile then start the compiled app.
I can indeed reproduce the error with both GraalVM 22.0 and 22.1 but that sounds like an Hibernate level error so not sure what we can do at Spring Native level.
I see. I guess I should close the issue here.
I've got the very same issue trying to run the native image. I'm using Spring Boot 3.0.0 and still having trouble with that. Here are my relevant dependencies:
And this is the output showing the error: Invalid logger interface org.hibernate.internal.log.IncubationLogger (implementation not found in jdk.internal.loader.ClassLoaders$AppClassLoader@77f03bb1)
. Thanks in advance for your time.
docker-document-1 |
docker-document-1 | . ____ _ __ _ _
docker-document-1 | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
docker-document-1 | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
docker-document-1 | \\/ ___)| |_)| | | | | || (_| | ) ) ) )
docker-document-1 | ' |____| .__|_| |_|_| |_\__, | / / / /
docker-document-1 | =========|_|==============|___/=/_/_/_/
docker-document-1 | :: Spring Boot :: (v3.0.0)
docker-document-1 |
docker-document-1 | 2022-12-13T22:57:28.432Z INFO 1 --- [ main] c.example.service.document.Application : Starting AOT-processed Application using Java 17.0.5 with PID 1 (/workspace/com.example.service.document.Application started by cnb in /workspace)
docker-document-1 | 2022-12-13T22:57:28.432Z INFO 1 --- [ main] c.example.service.document.Application : No active profile set, falling back to 1 default profile: "default"
docker-document-1 | 2022-12-13T22:57:28.459Z INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8082 (http)
docker-document-1 | 2022-12-13T22:57:28.460Z INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
docker-document-1 | 2022-12-13T22:57:28.460Z INFO 1 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.1]
docker-document-1 | 2022-12-13T22:57:28.464Z INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
docker-document-1 | 2022-12-13T22:57:28.464Z INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 32 ms
docker-document-1 | 2022-12-13T22:57:28.485Z INFO 1 --- [ main] liquibase.integration : Liquibase did not run because 'shouldRun' property was set to false on liquibase Liquibase Spring bean.
docker-document-1 | 2022-12-13T22:57:28.491Z INFO 1 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
docker-document-1 | 2022-12-13T22:57:28.492Z INFO 1 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.1.5.Final
docker-document-1 | 2022-12-13T22:57:28.496Z INFO 1 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
docker-document-1 | 2022-12-13T22:57:28.510Z INFO 1 --- [ task-1] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@7e305d5c
docker-document-1 | 2022-12-13T22:57:28.510Z INFO 1 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
docker-document-1 | 2022-12-13T22:57:28.514Z INFO 1 --- [ task-1] SQL dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
docker-document-1 | 2022-12-13T22:57:28.515Z WARN 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'documentMapperImpl': Unsatisfied dependency expressed through field 'documentRepository': Error creating bean with name 'documentRepository': Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'
docker-document-1 | 2022-12-13T22:57:28.515Z INFO 1 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
docker-document-1 | 2022-12-13T22:57:28.515Z WARN 1 --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'entityManagerFactory': java.lang.IllegalStateException: Failed to asynchronously initialize native EntityManagerFactory: java.lang.ExceptionInInitializerError
docker-document-1 | 2022-12-13T22:57:28.515Z INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
docker-document-1 | 2022-12-13T22:57:28.515Z INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
docker-document-1 | 2022-12-13T22:57:28.516Z INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
docker-document-1 | 2022-12-13T22:57:28.518Z ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
docker-document-1 |
docker-document-1 | org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'documentMapperImpl': Unsatisfied dependency expressed through field 'documentRepository': Error creating bean with name 'documentRepository': Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'
docker-document-1 | at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveValue(AutowiredFieldValueResolver.java:195) ~[na:na]
docker-document-1 | at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveObject(AutowiredFieldValueResolver.java:154) ~[na:na]
docker-document-1 | at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolve(AutowiredFieldValueResolver.java:143) ~[na:na]
docker-document-1 | at com.example.service.document.mapper.DocumentMapperImpl__Autowiring.apply(DocumentMapperImpl__Autowiring.java:15) ~[na:na]
docker-document-1 | at org.springframework.beans.factory.support.InstanceSupplier$1.get(InstanceSupplier.java:82) ~[na:na]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[com.example.service.document.Application:3.0.0]
docker-document-1 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[com.example.service.document.Application:3.0.0]
docker-document-1 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[com.example.service.document.Application:3.0.0]
docker-document-1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[com.example.service.document.Application:3.0.0]
docker-document-1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[com.example.service.document.Application:3.0.0]
docker-document-1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[com.example.service.document.Application:3.0.0]
docker-document-1 | at com.example.service.document.Application.main(Application.java:10) ~[com.example.service.document.Application:na]
docker-document-1 | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentRepository': Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'
docker-document-1 | at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:377) ~[na:na]
docker-document-1 | at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:135) ~[na:na]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1663) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1412) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveValue(AutowiredFieldValueResolver.java:189) ~[na:na]
docker-document-1 | ... 23 common frames omitted
docker-document-1 | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Failed to asynchronously initialize native EntityManagerFactory: java.lang.ExceptionInInitializerError
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:365) ~[na:na]
docker-document-1 | ... 36 common frames omitted
docker-document-1 | Caused by: java.lang.IllegalStateException: Failed to asynchronously initialize native EntityManagerFactory: java.lang.ExceptionInInitializerError
docker-document-1 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.getNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:575) ~[com.example.service.document.Application:na]
docker-document-1 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:519) ~[com.example.service.document.Application:na]
docker-document-1 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:733) ~[na:na]
docker-document-1 | at jdk.proxy4/jdk.proxy4.$Proxy56.getMetamodel(Unknown Source) ~[na:na]
docker-document-1 | at java.base@17.0.5/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
docker-document-1 | at java.base@17.0.5/java.util.Iterator.forEachRemaining(Iterator.java:133) ~[com.example.service.document.Application:na]
docker-document-1 | at java.base@17.0.5/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845) ~[com.example.service.document.Application:na]
docker-document-1 | at java.base@17.0.5/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[com.example.service.document.Application:na]
docker-document-1 | at java.base@17.0.5/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[com.example.service.document.Application:na]
docker-document-1 | at java.base@17.0.5/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[com.example.service.document.Application:na]
docker-document-1 | at java.base@17.0.5/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[com.example.service.document.Application:na]
docker-document-1 | at java.base@17.0.5/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[com.example.service.document.Application:na]
docker-document-1 | at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.getMetamodels(JpaMetamodelMappingContextFactoryBean.java:94) ~[com.example.service.document.Application:3.0.0]
docker-document-1 | at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:68) ~[com.example.service.document.Application:3.0.0]
docker-document-1 | at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:44) ~[com.example.service.document.Application:3.0.0]
docker-document-1 | at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:142) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747) ~[com.example.service.document.Application:6.0.2]
docker-document-1 | ... 43 common frames omitted
docker-document-1 | Caused by: java.lang.ExceptionInInitializerError: null
docker-document-1 | at org.hibernate.internal.util.config.ConfigurationHelper.getPreferredSqlTypeCodeForUuid(ConfigurationHelper.java:560) ~[na:na]
docker-document-1 | at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:395) ~[na:na]
docker-document-1 | at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:143) ~[na:na]
docker-document-1 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350) ~[com.example.service.document.Application:6.1.5.Final]
docker-document-1 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421) ~[com.example.service.document.Application:6.1.5.Final]
docker-document-1 | at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66) ~[na:na]
docker-document-1 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[com.example.service.document.Application:na]
docker-document-1 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[com.example.service.document.Application:na]
docker-document-1 | at java.base@17.0.5/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[com.example.service.document.Application:na]
docker-document-1 | at java.base@17.0.5/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[com.example.service.document.Application:na]
docker-document-1 | at java.base@17.0.5/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
docker-document-1 | at java.base@17.0.5/java.lang.Thread.run(Thread.java:833) ~[com.example.service.document.Application:na]
docker-document-1 | at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775) ~[com.example.service.document.Application:na]
docker-document-1 | at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203) ~[na:na]
docker-document-1 | Caused by: java.lang.IllegalArgumentException: Invalid logger interface org.hibernate.internal.log.IncubationLogger (implementation not found in jdk.internal.loader.ClassLoaders$AppClassLoader@77f03bb1)
docker-document-1 | at org.jboss.logging.Logger.doGetMessageLogger(Logger.java:2564) ~[com.example.service.document.Application:3.5.0.Final]
docker-document-1 | at org.jboss.logging.Logger.getMessageLogger(Logger.java:2530) ~[com.example.service.document.Application:3.5.0.Final]
docker-document-1 | at org.jboss.logging.Logger.getMessageLogger(Logger.java:2516) ~[com.example.service.document.Application:3.5.0.Final]
docker-document-1 | at org.hibernate.internal.log.IncubationLogger.<clinit>(IncubationLogger.java:25) ~[na:na]
docker-document-1 | ... 14 common frames omitted
docker-document-1 |
docker-document-1 exited with code 1
Did anyone try to compile a project using Hibernate Search?
I tried to compile a spring-boot app where we are using Hibernate Search, full text search on name fields of entities like users.
(annotations like
@Field
,@Indexed
,@Analyzer
and APIsorg.hibernate.search.query.dsl.QueryBuilder
,org.hibernate.search.jpa.FullTextQuery
)Compilation went fine but the app does not boot-up.
I created an empty project:
It clearly appears that there is some conflict between the 2 libraries, but I have no idea how to tackle the issue.
Running the compiled JAR succeeds:
I use the following Java version:
Here is the command I use to compile the app:
The only Java code is the main file:
Here is the pom file (if you un-comment the 2 dependencies you get the version that fails):
The
application.properties
file contains the database parameters, something like:And the console output (stack trace) is: