]
Emmanuel Bernard updated HSEARCH-1115:
--------------------------------------
Component/s: engine
Affects Version/s: 4.1.0.Final
Pull Requests:
Failure to load Analyzer class when deployed into AS7
-----------------------------------------------------
Key: HSEARCH-1115
URL:
https://hibernate.onjira.com/browse/HSEARCH-1115
Project: Hibernate Search
Issue Type: Bug
Components: engine
Affects Versions: 4.1.0.Final
Reporter: Randall Hauch
Fix For: 4.1.1.Final, 4.2
Specifying an analyzer class via the "hibernate.search.analyzer" configuration
property results in an exception when initializing the Hibernate Search engine within the
AS7 environment:
{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)
...
{code}
Even setting the "hibernate.search.analyzer" property to
"org.apache.lucene.analysis.standard.StandardAnalyzer" (which happens to be the
default if no analyzer class is specified) will also fail.
I believe this exception is occurring within the AS7 module class loading environment
because during initialization of the Hibernate Search engine (e.g.,
{{SearchFactoryBuilder.buildSearchFactory}}), the {{ConfigContext.initAnalyzer}} method is
called and uses Hibernate's {{ReflectionHelper}} class to try to load the analyzer
class (see [this
code|https://github.com/hibernate/hibernate-search/blob/4.1.0.Final/hiber...]).
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.
A better solution needs to be found in order for the analyzer class to be specified.
Ideally, the solution should be flexible enough so that any AS7 subsystem that uses
Hibernate Search can specify the analyzer classname and module.
See [this forum
discussion|https://forum.hibernate.org/viewtopic.php?f=9&t=1015297&am...]
for discussion and additional context.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: