Jakarta Batch not working in native mode with JBeret

Hi here,

Thanks for the huge work for these modules. I’m using hibernate-search-orm with elastic backend in Quarkus framework.

For some reasons, sometimes I want to mass reindex using a MassIndexingJob.

I used org.hibernate.search:hibernate-search-mapper-orm-jakarta-batch-jberet in 7.X version (also tried with the 8.0.0.Alpha1)

When I run the application in local, everything works perfectly, but when I achieve a native image build, I got some issues with the job. The error returned is:

JBERET000007: Failed to run job hibernate-search-mass-indexing, , 
org.jberet.job.model.Job@41191bbf: java.lang.IllegalStateException: 
JBERET000600: Failed to create artifact with ref name 
org.hibernate.search.jakarta.batch.core.massindexing.spi.JobContextSetupListener

I found this Jira ticket Jira but I’m not sure to understand if it’s the same scenario as my local run works perfectly.

Thanks for future help !

Hey @qdesbin ,

Hibernate Search Jakarta Batch module does not have a Quarkus extension (and is not included in the existing ones), so while it probably works okay in the JVM mode, some additional work is most likely required to make it work in the native mode.

If you want to add another Hibernate Search jar, you should match the versions (see which one is used by Quarkus in the version you currently use).

From the shared logs, it’s hard to say what exactly went wrong. I can see that there’s a Quarkiverse extension for JBeret,so you probably want to use that, as there might be some things already addressed:

Other issues that come to mind could be missing resources (Tips for writing native applications - Quarkus) but as batch indexing job xml lives in a meta-inf I’d assume this one is not removed.

As for the Jira you’ve mentioned… while, in general, it is a problem since you are using Quarkus (hence Hibernate ORM) you should be more or less “not affected” by that issue, as the fallback will work, and the session will be provided to the batch job

With that, I’d suggest looking at the regular massindexer: Hibernate Search 8.0.0.Alpha1: Reference Documentation it should be able to do the same job as the batch indexer, and it should work fine in Quarkus out of the box.

Thanks for your quick answer !

I’ve effectively forgot to mention that I use io.quarkiverse.jberet:quarkus-jberet extension :wink:

I’ll look to regular massindexer, reading the docs looks like a good option, I can’t remember why I ended by choose jberet (maybe a misunderstanding)

I can confirm that is working directly with SearchSession and the regular MassIndexer, thanks !

1 Like