We're updating the issue view to help you get more done. 

Hibernate Search does not reuse JavaReflectionManager from Hibernate.

Description

The code in the method SearchConfigurationFromHibernateCore#getReflectionManager() was written for the old Hibernate and does not work anymore with Hibernate 5. The ConfigurationService class from Hibernate does not have the method "getReflectionManager". And therefore the method SearchConfigurationFromHibernateCore#getReflectionManager() falls back to create its own instance of JavaReflectionManager. This leads to higher memory consumption.

I have prepared a pull request for this issue. But merging the pull request breaks the WildFly integration tests with following message:

1 2 Caused by: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"MemberRegistrationIT.war#primary\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"MemberRegistrationIT.war#primary\": java.lang.LinkageError: loader constraint violation: when resolving interface method \"org.hibernate.boot.spi.MetadataBuildingOptions.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager;\" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/hibernate/search/cfg/impl/SearchConfigurationFromHibernateCore, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method's defining class, org/hibernate/boot/spi/MetadataBuildingOptions, have different Class objects for the type org/hibernate/annotations/common/reflection/ReflectionManager used in the signature Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method \"org.hibernate.boot.spi.MetadataBuildingOptions.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager;\" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/hibernate/search/cfg/impl/SearchConfigurationFromHibernateCore, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method's defining class, org/hibernate/boot/spi/MetadataBuildingOptions, have different Class objects for the type org/hibernate/annotations/common/reflection/ReflectionManager used in the signature”}}

To fix this error the definition of the Hibernate module in WildFly must be changed to export the "org.hibernate.commons-annotations" module (s. attached patch for details).

Environment

None

Status

Assignee

Andrej Golovnin

Reporter

Andrej Golovnin

Labels

None

Suitable for new contributors

Yes, likely

Feedback Requested

None

Fix versions

Affects versions

5.5.0.Final

Priority

Major