Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration from Spring Boot 3.1.5 to 3.2.0 HibernateSearch Index Building fails #38585

Closed
ajobra76 opened this issue Nov 28, 2023 · 10 comments
Closed
Labels
for: external-project For an external project and not something we can fix

Comments

@ajobra76
Copy link

ajobra76 commented Nov 28, 2023

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EntityManagerFactory' defined in class path resource [xyz/config/DataSourceConfig.class]: [PersistenceUnit: xyz] Unable to build Hibernate
SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/home/xyz/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/home/xyz/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/': HSEARCH900014: Exception while building Jandex index for '
jar:nested:/home/xyz/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.j
ar!/': read CEN tables failed
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1775) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1173) ~[spring-context-6.1.1.jar!/:6.1.1]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:936) ~[spring-context-6.1.1.jar!/:6.1.1]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.1.1.jar!/:6.1.1]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at de.impp.iims.IimsApplication.main(IimsApplication.java:21) ~[!/:0.0.1-SNAPSHOT]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91) ~[iims-app.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53) ~[iims-app.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58) ~[iims-app.jar:0.0.1-SNAPSHOT]
Caused by: jakarta.persistence.PersistenceException: [PersistenceUnit: iims] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Ja
ndex index for code source location 'jar:nested:/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/home/fxyz-app.jar/!
BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/hxyz-app.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for
 code source at 'jar:nested:/home/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/': read CEN tables failed
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-6.1.1.jar!/:6.1.1]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.1.jar!/:6.1.1]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1822) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1771) ~[spring-beans-6.1.1.jar!/:6.1.1]
        ... 23 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/'
: HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/home/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/home/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/home/xyz-app.jar/!BOOT-INF/lib/xyz-0.0.1-SNAPSHOT.jar!/': read CEN tables `failed`
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.jandexIndexForCodeSourceLocation(AnnotationMappingConfigurationContextImpl.java:234) ~[hibernate-search-mapper-pojo-
base-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.buildJandexIndex(AnnotationMappingConfigurationContextImpl.java:201) ~[hibernate-search-mapper-pojo-base-6.2.2.Final
.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.lambda$configure$0(AnnotationMappingConfigurationContextImpl.java:127) ~[hibernate-search-mapper-pojo-base-6.2.2.Fin
al.jar!/:6.2.2.Final]
        at org.hibernate.search.util.common.jar.spi.JandexBehavior.doWithJandex(JandexBehavior.java:17) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.configure(AnnotationMappingConfigurationContextImpl.java:126) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:
6.2.2.Final]
        at org.hibernate.search.mapper.pojo.mapping.spi.AbstractPojoMappingInitiator.configure(AbstractPojoMappingInitiator.java:134) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmMappingInitiator.configure(HibernateOrmMappingInitiator.java:163) ~[hibernate-search-mapper-orm-orm6-6.2.2.Final.jar!/:6.2.2.Final]
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 28, 2023
@wilkinsona
Copy link
Member

This looks as if it may be caused by the new nested jar support. Can you please try with the classic loader implementation and let us know if the problem still occurs? A minimal sample that reproduces the problem would also be very useful.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Nov 28, 2023
@ajobra76
Copy link
Author

ajobra76 commented Nov 28, 2023

Thank you very much for your advice. Since we use spring-boot-starter-parent we added

<plugin>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-maven-plugin</artifactId>
	<executions>
		<execution>
			<id>repackage</id>
			<configuration>
				<loaderImplementation>CLASSIC</loaderImplementation>
			</configuration>
		</execution>
	</executions>
</plugin>

to our maven pom and could successfully start our application again.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 28, 2023
@wilkinsona
Copy link
Member

I'm struggling to reproduce the exact failure you are experiencing, @ajobra76. I have managed to trigger the following failure:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 102, end -1, length 102
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1775) ~[spring-beans-6.1.1.jar!/:6.1.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-6.1.1.jar!/:6.1.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.1.1.jar!/:6.1.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.1.jar!/:6.1.1]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.1.jar!/:6.1.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.1.jar!/:6.1.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.1.jar!/:6.1.1]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1173) ~[spring-context-6.1.1.jar!/:6.1.1]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:936) ~[spring-context-6.1.1.jar!/:6.1.1]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.1.1.jar!/:6.1.1]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) ~[spring-boot-3.2.0.jar!/:3.2.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) ~[spring-boot-3.2.0.jar!/:3.2.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) ~[spring-boot-3.2.0.jar!/:3.2.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar!/:3.2.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar!/:3.2.0]
	at com.example.gh38585.Gh38585Application.main(Gh38585Application.java:10) ~[!/:0.0.1-SNAPSHOT]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91) ~[gh-38585-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53) ~[gh-38585-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
	at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58) ~[gh-38585-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: jakarta.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 102, end -1, length 102
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-6.1.1.jar!/:6.1.1]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.1.jar!/:6.1.1]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.1.1.jar!/:6.1.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1822) ~[spring-beans-6.1.1.jar!/:6.1.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1771) ~[spring-beans-6.1.1.jar!/:6.1.1]
	... 22 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 102, end -1, length 102
	at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.jandexIndexForCodeSourceLocation(AnnotationMappingConfigurationContextImpl.java:234) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.buildJandexIndex(AnnotationMappingConfigurationContextImpl.java:201) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.lambda$configure$0(AnnotationMappingConfigurationContextImpl.java:127) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.util.common.jar.spi.JandexBehavior.doWithJandex(JandexBehavior.java:17) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.configure(AnnotationMappingConfigurationContextImpl.java:126) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.mapper.pojo.mapping.spi.AbstractPojoMappingInitiator.configure(AbstractPojoMappingInitiator.java:134) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmMappingInitiator.configure(HibernateOrmMappingInitiator.java:163) ~[hibernate-search-mapper-orm-orm6-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.engine.common.impl.SearchIntegrationBuilder$MappingBuildingState.collect(SearchIntegrationBuilder.java:270) ~[hibernate-search-engine-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.engine.common.impl.SearchIntegrationBuilder.prepareBuild(SearchIntegrationBuilder.java:148) ~[hibernate-search-engine-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchPreIntegrationService$NotBooted.doBootFirstPhase(HibernateSearchPreIntegrationService.java:279) ~[hibernate-search-mapper-orm-orm6-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateOrmIntegrationBooterImpl.bootNow(HibernateOrmIntegrationBooterImpl.java:179) ~[hibernate-search-mapper-orm-orm6-6.2.2.Final.jar!/:6.2.2.Final]
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646) ~[na:na]
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[na:na]
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147) ~[na:na]
	at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:41) ~[hibernate-search-mapper-orm-orm6-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) ~[hibernate-core-6.3.1.Final.jar!/:6.3.1.Final]
	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295) ~[hibernate-core-6.3.1.Final.jar!/:6.3.1.Final]
	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:450) ~[hibernate-core-6.3.1.Final.jar!/:6.3.1.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1507) ~[hibernate-core-6.3.1.Final.jar!/:6.3.1.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) ~[spring-orm-6.1.1.jar!/:6.1.1]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.1.1.jar!/:6.1.1]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.1.1.jar!/:6.1.1]
	... 26 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 102, end -1, length 102
	at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:113) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.jandexIndexForCodeSourceLocation(AnnotationMappingConfigurationContextImpl.java:227) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
	... 47 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH900014: Exception while building Jandex index for 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 102, end -1, length 102
	at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:109) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
	... 48 common frames omitted
Caused by: java.io.IOException: HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/Users/awilkinson/dev/temp/gh-38585/build/libs/gh-38585-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 102, end -1, length 102
	at org.hibernate.search.util.common.jar.impl.CodeSource.initFileSystem(CodeSource.java:162) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.util.common.jar.impl.CodeSource.classesPathOrFail(CodeSource.java:128) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:106) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
	... 48 common frames omitted
Caused by: java.lang.StringIndexOutOfBoundsException: begin 102, end -1, length 102
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4606) ~[na:na]
	at java.base/java.lang.String.substring(String.java:2709) ~[na:na]
	at org.hibernate.search.util.common.jar.impl.CodeSource.extractedJarNestedPath(CodeSource.java:214) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.util.common.jar.impl.CodeSource.tryInitJarFileSystem(CodeSource.java:172) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
	at org.hibernate.search.util.common.jar.impl.CodeSource.initFileSystem(CodeSource.java:139) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
	... 50 common frames omitted

As you will see, it's not exactly the same as yours. A minimal example that reproduces the read CEN tables 'failed' problem would be very useful here.

@wilkinsona
Copy link
Member

wilkinsona commented Nov 28, 2023

If you're not using Jandex indexes, I think you can work around the problem with the following bean:

@Bean
HibernateOrmSearchMappingConfigurer searchMappingConfigurer() {
    return (context) -> context.annotationMapping().discoverJandexIndexesFromAddedTypes(false);
}

And this configuration property to enable its use:

spring.jpa.properties.hibernate.search.mapping.configurer: bean:searchMappingConfigurer

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Nov 29, 2023
@wilkinsona
Copy link
Member

#38595 should have hopefully fixed the problem with reading the CEN tables. That fix is in the latest 3.2.1-SNAPSHOT build that's available from https://repo.spring.io. Could please give it a try with the new default (not classic) loader implementation?

@ajobra76
Copy link
Author

... we tested the snapshot 3.2.1version. It seems to be now a different Error

2023-11-30T11:46:34.753+01:00  INFO 33666 --- [           main] b.i.HibernateSearchPreIntegrationService : HSEARCH000034: Hibernate Search version 6.2.2.Final
2023-11-30T11:46:36.115+01:00 ERROR 33666 --- [           main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: iims] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': begin 130, end -1, length 130
2023-11-30T11:46:36.116+01:00  WARN 33666 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EntityManagerFactory' defined in class path resource [de/impp/iims/config/DataSourceConfig.class]: [PersistenceUnit: iims] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': begin 130, end -1, length 130
2023-11-30T11:46:36.116+01:00  INFO 33666 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2023-11-30T11:46:36.119+01:00  INFO 33666 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2023-11-30T11:46:36.121+01:00  INFO 33666 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-11-30T11:46:36.133+01:00  INFO 33666 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-11-30T11:46:36.159+01:00 ERROR 33666 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EntityManagerFactory' defined in class path resource [de/impp/iims/config/DataSourceConfig.class]: [PersistenceUnit: iims] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': begin 130, end -1, length 130
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1775) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1173) ~[spring-context-6.1.1.jar!/:6.1.1]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:936) ~[spring-context-6.1.1.jar!/:6.1.1]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.1.1.jar!/:6.1.1]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.1-SNAPSHOT.jar!/:3.2.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.1-SNAPSHOT.jar!/:3.2.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.1-SNAPSHOT.jar!/:3.2.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-3.2.1-SNAPSHOT.jar!/:3.2.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.1-SNAPSHOT.jar!/:3.2.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-3.2.1-SNAPSHOT.jar!/:3.2.1-SNAPSHOT]
        at de.impp.iims.IimsApplication.main(IimsApplication.java:21) ~[!/:0.0.1-SNAPSHOT]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91) ~[app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53) ~[app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58) ~[app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: jakarta.persistence.PersistenceException: [PersistenceUnit: iims] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': begin 130, end -1, length 130
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-6.1.1.jar!/:6.1.1]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.1.jar!/:6.1.1]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1822) ~[spring-beans-6.1.1.jar!/:6.1.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1771) ~[spring-beans-6.1.1.jar!/:6.1.1]
        ... 23 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': begin 130, end -1, length 130
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.jandexIndexForCodeSourceLocation(AnnotationMappingConfigurationContextImpl.java:234) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.buildJandexIndex(AnnotationMappingConfigurationContextImpl.java:201) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.lambda$configure$0(AnnotationMappingConfigurationContextImpl.java:127) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.util.common.jar.spi.JandexBehavior.doWithJandex(JandexBehavior.java:17) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.configure(AnnotationMappingConfigurationContextImpl.java:126) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.pojo.mapping.spi.AbstractPojoMappingInitiator.configure(AbstractPojoMappingInitiator.java:134) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmMappingInitiator.configure(HibernateOrmMappingInitiator.java:163) ~[hibernate-search-mapper-orm-orm6-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.engine.common.impl.SearchIntegrationBuilder$MappingBuildingState.collect(SearchIntegrationBuilder.java:270) ~[hibernate-search-engine-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.engine.common.impl.SearchIntegrationBuilder.prepareBuild(SearchIntegrationBuilder.java:148) ~[hibernate-search-engine-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchPreIntegrationService$NotBooted.doBootFirstPhase(HibernateSearchPreIntegrationService.java:279) ~[hibernate-search-mapper-orm-orm6-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateOrmIntegrationBooterImpl.bootNow(HibernateOrmIntegrationBooterImpl.java:179) ~[hibernate-search-mapper-orm-orm6-6.2.2.Final.jar!/:6.2.2.Final]
        at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646) ~[na:na]
        at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[na:na]
        at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147) ~[na:na]
        at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:41) ~[hibernate-search-mapper-orm-orm6-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) ~[hibernate-core-6.3.1.Final.jar!/:6.3.1.Final]
        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295) ~[hibernate-core-6.3.1.Final.jar!/:6.3.1.Final]
        at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:450) ~[hibernate-core-6.3.1.Final.jar!/:6.3.1.Final]
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1507) ~[hibernate-core-6.3.1.Final.jar!/:6.3.1.Final]
        at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) ~[spring-orm-6.1.1.jar!/:6.1.1]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.1.1.jar!/:6.1.1]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.1.1.jar!/:6.1.1]
        ... 27 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': begin 130, end -1, length 130
        at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:113) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.jandexIndexForCodeSourceLocation(AnnotationMappingConfigurationContextImpl.java:227) ~[hibernate-search-mapper-pojo-base-6.2.2.Final.jar!/:6.2.2.Final]
        ... 48 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH900014: Exception while building Jandex index for 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': begin 130, end -1, length 130
        at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:109) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        ... 49 common frames omitted
Caused by: java.io.IOException: HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/MY/PROJECTS/BRANCHES/axolotl-extendedSearch2/app/target/app-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/entities-0.0.1-SNAPSHOT.jar!/': begin 130, end -1, length 130
        at org.hibernate.search.util.common.jar.impl.CodeSource.initFileSystem(CodeSource.java:162) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.util.common.jar.impl.CodeSource.classesPathOrFail(CodeSource.java:128) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:106) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        ... 49 common frames omitted
Caused by: java.lang.StringIndexOutOfBoundsException: begin 130, end -1, length 130
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4604) ~[na:na]
        at java.base/java.lang.String.substring(String.java:2707) ~[na:na]
        at org.hibernate.search.util.common.jar.impl.CodeSource.extractedJarNestedPath(CodeSource.java:214) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.util.common.jar.impl.CodeSource.tryInitJarFileSystem(CodeSource.java:172) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        at org.hibernate.search.util.common.jar.impl.CodeSource.initFileSystem(CodeSource.java:139) ~[hibernate-search-util-common-6.2.2.Final.jar!/:6.2.2.Final]
        ... 51 common frames omitted

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 30, 2023
@don-vip
Copy link

don-vip commented Dec 2, 2023

I have the same error with 3.2.0:

2023-12-02T01:11:27.554Z  INFO 8 --- [main] b.i.HibernateSearchPreIntegrationService : HSEARCH000034: Hibernate Search version 6.2.2.Final
2023-12-02T01:11:32.663Z ERROR 8 --- [main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: commons] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.e Jandex index for code source location 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/data/project/s!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nar/!BOOT-INF/classes/!/': begin 104, end -1, length 104
2023-12-02T01:11:32.730Z  WARN 8 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creat[org/wikimedia/commons/donvip/spacemedia/data/commons/CommonsDbConfiguration.class]: [PersistenceUnit: commons] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119ed:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-ex index for 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/data/project/spacemedia/spacemedia/target/th 104
2023-12-02T01:11:32.857Z  INFO 8 --- [main] .s.b.a.l.ConditionEvaluationReportLogger :

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-12-02T01:11:32.953Z ERROR 8 --- [main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonsEntityManagerFactory' defined in class path resource [org/wikimedia/commons/donvip/spacemedia/data/commons/CommonsDbConfiguration.class]: [Pern is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INFted:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-de source at 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 104, end -1, length 104
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1775)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1173)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:936)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:323)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331)
        at org.wikimedia.commons.donvip.spacemedia.apps.SpacemediaWebApplication.main(SpacemediaWebApplication.java:30)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91)
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53)
        at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58)
Caused by: jakarta.persistence.PersistenceException: [PersistenceUnit: commons] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving theemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!roject/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.ja
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1822)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1771)
        ... 23 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH700119: Exception while retrieving the Jandex index for code source location 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900014: Exception while building Jandex index for 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-for code source at 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 104, end -1, length 104
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.jandexIndexForCodeSourceLocation(AnnotationMappingConfigurationContextImpl.java:234)
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.buildJandexIndex(AnnotationMappingConfigurationContextImpl.java:201)
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.lambda$configure$0(AnnotationMappingConfigurationContextImpl.java:127)
        at org.hibernate.search.util.common.jar.spi.JandexBehavior.doWithJandex(JandexBehavior.java:17)
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.configure(AnnotationMappingConfigurationContextImpl.java:126)
        at org.hibernate.search.mapper.pojo.mapping.spi.AbstractPojoMappingInitiator.configure(AbstractPojoMappingInitiator.java:134)
        at org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmMappingInitiator.configure(HibernateOrmMappingInitiator.java:163)
        at org.hibernate.search.engine.common.impl.SearchIntegrationBuilder$MappingBuildingState.collect(SearchIntegrationBuilder.java:270)
        at org.hibernate.search.engine.common.impl.SearchIntegrationBuilder.prepareBuild(SearchIntegrationBuilder.java:148)
        at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchPreIntegrationService$NotBooted.doBootFirstPhase(HibernateSearchPreIntegrationService.java:279)
        at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateOrmIntegrationBooterImpl.bootNow(HibernateOrmIntegrationBooterImpl.java:179)
        at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
        at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
        at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
        at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:41)
        at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35)
        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295)
        at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:450)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1507)
        at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75)
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
        ... 27 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH900013: Exception while accessing Jandex index for 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCcemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-IN
        at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:113)
        at org.hibernate.search.mapper.pojo.mapping.definition.annotation.impl.AnnotationMappingConfigurationContextImpl.jandexIndexForCodeSourceLocation(AnnotationMappingConfigurationContextImpl.java:227)
        ... 48 common frames omitted
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH900014: Exception while building Jandex index for 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': HSEARCHemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 104, end -1, length 104
        at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:109)
        ... 49 common frames omitted
Caused by: java.io.IOException: HSEARCH900016: Cannot open filesystem for code source at 'jar:nested:/data/project/spacemedia/spacemedia/target/web/spacemedia-0.5.0-SNAPSHOT.jar/!BOOT-INF/classes/!/': begin 104, end -1, length 104
        at org.hibernate.search.util.common.jar.impl.CodeSource.initFileSystem(CodeSource.java:162)
        at org.hibernate.search.util.common.jar.impl.CodeSource.classesPathOrFail(CodeSource.java:128)
        at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:106)
        ... 49 common frames omitted
Caused by: java.lang.StringIndexOutOfBoundsException: begin 104, end -1, length 104
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4602)
        at java.base/java.lang.String.substring(String.java:2705)
        at org.hibernate.search.util.common.jar.impl.CodeSource.extractedJarNestedPath(CodeSource.java:214)
        at org.hibernate.search.util.common.jar.impl.CodeSource.tryInitJarFileSystem(CodeSource.java:172)
        at org.hibernate.search.util.common.jar.impl.CodeSource.initFileSystem(CodeSource.java:139)
        ... 51 common frames omitted

@philwebb
Copy link
Member

philwebb commented Dec 2, 2023

I think we're going to need to ask the Hibernate Search team if they can refine their nested jar support code. It looks like this code is problematic when there's only a single !/ separator.

Our new JAR url format is jar:nested:/path/myapp.jar/!BOOT-INF/lib/nested.jar!/com/Example.class. Note that there is only a single !/ (the nested separator is /!).

Reading the hibernate code I think afterPathSeparatorIndex will be a positive value but secondPathSeparatorIndex will be -1. The while loop is skipped and then the StringIndexOutOfBoundsException is thrown.

@don-vip or @ajobra76, would one of you mind raising this on the Hibernate issue tracker please?

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2023
@philwebb
Copy link
Member

philwebb commented Dec 2, 2023

In the meantime, you can switch back to the classic loader implementation, details of how to do that are here.

@philwebb philwebb added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Dec 2, 2023
@don-vip
Copy link

don-vip commented Dec 2, 2023

Done: https://hibernate.atlassian.net/browse/HSEARCH-5028

stmsat added a commit to stmsat/hapi-fhir-jpaserver-starter that referenced this issue Jan 3, 2024
…ing-boot:run by defaults starts tomcat, while the jetty profile enables jetty

added a fix to run the generated war with spring-boot on tomcat, due to issues with spring-boot 3.2.0 spring-projects/spring-boot#38585
the jar generated with jetty doesn't work at the moment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

5 participants