Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Hibernate Search engine in AS7
PostPosted: Mon Apr 30, 2012 12:31 pm 
Newbie

Joined: Mon Apr 30, 2012 12:13 pm
Posts: 2
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!


Top
 Profile  
 
 Post subject: Re: Hibernate Search engine in AS7
PostPosted: Tue May 01, 2012 7:06 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2296
Location: Third rock from the Sun
Hi Randall,
I'm aware that our testing on AS7 as a module has been too limited. Ales Justin is also using Search (via Infinispan Query) as a module and had many classloading issues. Most were fixed very recently, I guess the Analyzer is not something he used.

We don't have a module for AS7 as the way we expect people to use it is to bundle it in the application itself; we definitely need to improve on this. Could you please open a JIRA? I will deal with these issues asap; undertunately I guess you might find other similar problems as it has never been a module and classloading of user extensions wasn't tested this way.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate Search engine in AS7
PostPosted: Tue May 01, 2012 9:51 am 
Newbie

Joined: Mon Apr 30, 2012 12:13 pm
Posts: 2
Thanks, Sanne. I've logged HSEARCH-1115.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.