I’m trying to run a Spring boot 2.7.9 application, with Hibernate search 6.2.0.Final.
Dependencies:
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm</artifactId>
<version>6.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-backend-elasticsearch</artifactId>
<version>6.2.0.Final</version>
</dependency>
But i’m getting this exception after packaging the application and try to run it.
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH900014: Exception while building Jandex index for 'jar:file:/C:/Users/paulo/a/repo/app/paulo-app-application/target/caps-paulo-app-application.jar!/BOOT-INF/lib/paulo-app-repository-aurora-0.0.1-SNAPSHOT.jar!/': HSEARCH900016: Cannot open filesystem for code source at 'jar:file:/C:/Users/paulo/a/repo/app/paulo-app-application/target/caps-paulo-app-application.jar!/BOOT-INF/lib/paulo-app-repository-aurora-0.0.1-SNAPSHOT.jar!/': HSEARCH900018: Cannot open a ZIP filesystem for code source at 'jar:file:/C:/Users/paulo/a/repo/app/paulo-app-application/target/caps-paulo-app-application.jar!/BOOT-INF/lib/paulo-app-repository-aurora-0.0.1-SNAPSHOT.jar!/', because the URI points to content inside a nested JAR.
at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:109)
... 50 common frames omitted
Caused by: java.io.IOException: HSEARCH900016: Cannot open filesystem for code source at 'jar:file:/C:/Users/paulo/a/repo/app/paulo-app-application/target/caps-paulo-app-application.jar!/BOOT-INF/lib/paulo-app-repository-aurora-0.0.1-SNAPSHOT.jar!/': HSEARCH900018: Cannot open a ZIP filesystem for code source at 'jar:file:/C:/Users/paulo/a/repo/app/paulo-app-application/target/caps-paulo-app-application.jar!/BOOT-INF/lib/paulo-app-repository-aurora-0.0.1-SNAPSHOT.jar!/', because the URI points to content inside a nested JAR.
at org.hibernate.search.util.common.jar.impl.CodeSource.initFileSystem(CodeSource.java:131)
at org.hibernate.search.util.common.jar.impl.CodeSource.classesPathOrFail(CodeSource.java:97)
at org.hibernate.search.util.common.jar.impl.JandexUtils.readOrBuildIndex(JandexUtils.java:106)
... 50 common frames omitted
Caused by: java.io.IOException: HSEARCH900018: Cannot open a ZIP filesystem for code source at 'jar:file:/C:/Users/paulo/a/repo/app/paulo-app-application/target/caps-paulo-app-application.jar!/BOOT-INF/lib/paulo-app-repository-aurora-0.0.1-SNAPSHOT.jar!/', because the URI points to content inside a nested JAR.
at org.hibernate.search.util.common.jar.impl.CodeSource.tryInitJarFileSystem(CodeSource.java:146)
at org.hibernate.search.util.common.jar.impl.CodeSource.initFileSystem(CodeSource.java:108)
... 52 common frames omitted
Seaching the Hibernate search code, i found inside CodeSource class, the code:
private void tryInitJarFileSystem(URI jarUri) throws IOException {
try {
nonDefaultFileSystem = FileSystems.newFileSystem( jarUri, Collections.emptyMap() );
classesPathInFileSystem = nonDefaultFileSystem.getRootDirectories().iterator().next();
// The ZipFileSystemProvider ignores the "path inside the JAR",
// so we need to take care of that ourselves.
String nestedPath = extractedJarNestedPath( jarUri );
if ( nestedPath != null ) {
Path nestedPathInFileSystem = classesPathInFileSystem.resolve( nestedPath );
if ( Files.isRegularFile( nestedPathInFileSystem ) ) {
// TODO HSEARCH-4744 support reading the content of nested JARs
throw log.cannotOpenNestedJar( jarUri );
}
classesPathInFileSystem = nestedPathInFileSystem;
}
}
catch (RuntimeException | IOException e) {
new SuppressingCloser( e )
.push( nonDefaultFileSystem );
nonDefaultFileSystem = null;
classesPathInFileSystem = null;
throw e;
}
}
There is a TODO:
// TODO HSEARCH-4744 support reading the content of nested JARs
Linked to a backlog Story:
https://hibernate.atlassian.net/browse/HSEARCH-4744
Is there a way to use Hibernate search 6.2 with nested JARs?
Or is there any predictions of when this issue is going to be solved?