Application runs with ant but not as jar

Hi,
i migrated my HS5 based application and it’s run fine when I start it locally with Intelij as ant application.
When i am using mvn clean package and run the resulting jar i get following message:

Caused by: org.hibernate.search.util.common.SearchException: HSEARCH000501: Invalid value for configuration property 'hibernate.search.background_failure_handler': ''. HSEARCH000579: Unable to resolve bean reference to type 'org.hibernate.search.engine.reporting.FailureHandler' and name 'log'. Failed to resolve bean from Hibernate Search's internal registry with exception: HSEARCH000578: No beans defined for type 'org.hibernate.search.engine.reporting.FailureHandler' and name 'log' in Hibernate Search's internal registry. Failed to resolve bean from bean manager with exception: HSEARCH000590: No configured bean manager. Failed to resolve bean from bean manager with exception: HSEARCH000591: Unable to resolve 'log' to a class extending 'org.hibernate.search.engine.reporting.FailureHandler': HSEARCH000530: Unable to load class 'log': Could not load requested class : log Failed to resolve bean using reflection with exception: HSEARCH000591: Unable to resolve 'log' to a class extending 'org.hibernate.search.engine.reporting.FailureHandler': HSEARCH000530: Unable to load class 'log': Could not load requested class : log

when i try to implement an own FailureHandler iam crashing into the next error:

Caused by: org.hibernate.search.util.common.SearchException: HSEARCH000501: Invalid value for configuration property 'hibernate.search.thread_provider': ''. HSEARCH000579: Unable to resolve bean reference to type 'org.hibernate.search.engine.environment.thread.spi.ThreadProvider' and name 'embedded'. Failed to resolve bean from Hibernate Search's internal registry with exception: HSEARCH000578: No beans defined for type 'org.hibernate.search.engine.environment.thread.spi.ThreadProvider' and name 'embedded' in Hibernate Search's internal registry. Failed to resolve bean from bean manager with exception: HSEARCH000590: No configured bean manager. Failed to resolve bean from bean manager with exception: HSEARCH000591: Unable to resolve 'embedded' to a class extending 'org.hibernate.search.engine.environment.thread.spi.ThreadProvider': HSEARCH000530: Unable to load class 'embedded': Could not load requested class : embedded Failed to resolve bean using reflection with exception: HSEARCH000591: Unable to resolve 'embedded' to a class extending 'org.hibernate.search.engine.environment.thread.spi.ThreadProvider': HSEARCH000530: Unable to load class 'embedded': Could not load requested class : embedded

it seems that some? standard implementations are missing. Any idea how this can happen?
my pom:

...
<hibernate.version>5.6.12.Final</hibernate.version>
<hibernate.jpa.version>1.0.1.Final</hibernate.jpa.version>
<hibernate-search-orm.version>6.1.8.Final</hibernate-search-orm.version>
...
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
  <version>${hibernate.version}</version>
</dependency>

<dependency>
  <groupId>org.hibernate.javax.persistence</groupId>
 <artifactId>hibernate-jpa-2.0-api</artifactId>
  <version>${hibernate.jpa.version}</version>
</dependency>

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-c3p0</artifactId>
  <version>${hibernate.version}</version>
</dependency>

<dependency>
  <groupId>org.hibernate.search</groupId>
  <artifactId>hibernate-search-mapper-orm</artifactId>
  <version>${hibernate-search-orm.version}</version>
</dependency>

<dependency>
  <groupId>org.hibernate.search</groupId>
  <artifactId>hibernate-search-backend-lucene</artifactId>
  <version>${hibernate-search-orm.version}</version>
</dependency>

i found also this java - Hibernate Search doesn't work when converting to jar - Stack Overflow
but this leads just to a similar error message.

Hey @VladDrakul1986
Thanks for reaching out. Please take a look at this post here - Missing Bean when using Hibernate Search as Jar? - #2 by yrodiere. It is the one mentioned in the SO question you’ve linked to. The problem there was with a different bean. But you can find suggestions on what you can try.
In general, it seems like a problem with jar packaging so you should look into that.

1 Like

i added a solution working for me