Hi,
I'm facing problems executing a hibernate-search query. Every time when I search for a term that is contained in the lucene-index, the following exception is thrown:
Code:
Caused by org.hibernate.search.SearchException with message: "No Lucene configuration set up for: de.gridworks.everein.model.Membership"
org.hibernate.search.engine.DocumentBuilderIndexedEntity.getDocumentId(DocumentBuilderIndexedEntity.java:567)
org.hibernate.search.engine.DocumentExtractor.extract(DocumentExtractor.java:69)
org.hibernate.search.engine.DocumentExtractor.extract(DocumentExtractor.java:88)
org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:304)
de.gridworks.everein.action.search.MembershipSearchBean$$M$485e644c.findMemberships(MembershipSearchBean.java:59)
de.gridworks.everein.action.search.MembershipSearchBean$$A$485e644c.findMemberships(<generated>)
de.gridworks.everein.action.search.MembershipSearchBean.findMemberships(MembershipSearchBean.java)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
de.gridworks.everein.action.search.MembershipSearchBean_$$_javassist_seam_18$$M$b5fbb65c.findMemberships(MembershipSearchBean_$$_javassist_seam_18.java)
de.gridworks.everein.action.search.MembershipSearchBean_$$_javassist_seam_18$$A$b5fbb65c.findMemberships(<generated>)
de.gridworks.everein.action.search.MembershipSearchBean_$$_javassist_seam_18.findMemberships(MembershipSearchBean_$$_javassist_seam_18.java)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
org.richfaces.component.UISuggestionBox.setupValue(UISuggestionBox.java:492)
org.richfaces.component.UISuggestionBox.broadcast(UISuggestionBox.java:424)
javax.faces.component.UIData.broadcast(UIData.java:938)
org.richfaces.component.UISuggestionBox.broadcast(UISuggestionBox.java:421)
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
org.ajax4jsf.component.AjaxViewRoot.broadcastAjaxEvents(AjaxViewRoot.java:348)
org.ajax4jsf.application.AjaxViewHandler.processAjaxEvents(AjaxViewHandler.java:216)
org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:169)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
java.lang.Thread.run(Thread.java:619)
Surprisingly that exception is only thrown when the term is contained in the index. For example if I search for 'Henry' the exception is thrown (because Henry is a token in an indexed field; I tested this with Luke) but if I search for 'Hen', everythings fine (of cause, no entities are found but also no exception is thrown).
I guess there must be a configuration error somewhere around there, because I'm using a similar code in another project without any problems. But I can't figure out how to fix it... Maybe this problem results in the fact that the persistence-unit is packaged in an external jar-file? However I'm able to manually index all existing entities on application startup without errors (as I mentioned, I can explore these indexed entities using Luke).
Here's my hibernate-config:
Code:
<property name="hibernate.search.default.directory_provider" value="org.hibernate.search.store.FSDirectoryProvider" />
<property name="hibernate.search.default.indexBase" value="../server/default/data/indexes" />
And the relevant code from my entity-mappings (I'm not showing non-indexed fields or getters/setters here):
Code:
@Indexed
@Entity
@Table(name = "app_memberships")
public class Membership implements java.io.Serializable {
@DocumentId
@Id @GeneratedValue
@Column(name = "membership_id")
private Integer ID = 0;
@Field
@Column(name = "membership_title")
private String Title;
}
And finally the code that is performing the search:
Code:
public List<Membership> findMemberships(Object searchString) throws Exception{
List<Membership> searchResults = null;
FullTextSession hibernateFullTextSession = (FullTextSession) hibernateSession;
// Abfrage über die Felder Nummer und Fragetext konfigurieren
QueryParser parser = new MultiFieldQueryParser(new String[]{"Title"}, new StandardAnalyzer());
org.apache.lucene.search.Query luceneQuery = parser.parse(String.valueOf(searchString));
org.hibernate.Query query = hibernateFullTextSession.createFullTextQuery(luceneQuery, Membership.class);
searchResults = query.list();
return searchResults;
}
I hope that anybody is able to help me with that issue... Thanks in advance!