Search code examples
javaspringspring-boothibernate-searchwildfly-10

How to disable Wildfly 10 Hibernate Search module without persistence.xml file is autoconfigured Spring Boot app?


Hi everyone!

I am developing Spring Boot 1.5 app with Hibernate Search 5.5. As standalone app it is running as I expected, but I have a problem with deploying it on Wildfly 10. During deployment it is throwing an exception: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype

I want to disable Wildfly Hibernate Search implementation and provide my own prepackaged with my app. I have found that I have to provide wildfly.jpa.hibernate.search.module = none property in in persistence.xml file. My question is how to do this without rewriting whole Spring Boot datasource autoconfiguration?


Solution

  • Finally I have found solution to force Wildfly not to load provided Hibernate Search module. I have read in Wildfly 10 documentation in chapter Class Loading in Wildfly, about providing jboss-deployment-structure.xml file. During building WAR file with my app I am adding this file in META-INF directory with following content:

    <?xml version="1.0"?>
    <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
        <deployment>
            <exclusions>
                <module name="org.hibernate.search.orm"/>
            </exclusions>
        </deployment>
    </jboss-deployment-structure>
    

    This configuration solved my problem and Wildfly is loading Hibernate Search packaged with my app.