I'm using the Hibernate Search engine as a Lucene clustering utility layer within within a library, and I'm creating an AS7 subsystem for that library. Unfortunately, I cannot specify an analyzer class without a ClassNotFoundException, because the ConfigContext class is using org.hibernate.annotation.common.util.ReflectionHelper, which in AS7's module system cannot see anything but the 'org.hibernate' module's classes (such as even Lucene's standard analyzer class).
Specifically, this is part of the exception stack trace:
Code:
Caused by: org.hibernate.search.SearchException: Analyzer found with an unknown definition: org.apache.lucene.analysis.standard.StandardAnalyzer
at org.hibernate.search.impl.ConfigContext.initLazyAnalyzers(ConfigContext.java:252)
at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:434)
at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:221)
at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:145)
This error is occurring because I'm specifying a "hibernate.search.analyzer" property with value of "org.apache.lucene.analysis.standard.StandardAnalyzer". (Yes, I know that's the default, but specifying the default in this way does showcase the problem.) Then during initialization, the ConfigContext.initAnalyzer method is called and uses Hibernate's ReflectionHelper class to try to load the analyzer class (see
the code). The ReflectionHelper uses the Thread context class loader to try to find the class or (if that fails) the class's class loader; neither of these work in AS7's module system, unless the JARs with the analyzer are defined within the "org.hibernate" module.
Is there already an AS7-compatible mechanism in place to change how Hibernate Search attempts to load the analyzer class(es)?
Is anyone working on an AS7 subsystem for Hibernate Search? If not, is there a recommended module structure to allow other subsystems to reuse just the Hibernate Search engine bits?
Thanks very much in advance!