Hi,
I´m using hibernate search in a simple project(standalone) and it works fine.
Now i´m trying to use it on a web project(richfaces + tomcat). I´m using the same class of the standalone project but does not work.
The "indexBase" property is configured like this
Code:
<property name="hibernate.search.default.indexBase">
../webapps/JBancoTalentos/WEB-INF/indices
</property>
in the standalone project, "indexBase" was configured like this
Code:
<property name="hibernate.search.default.indexBase">
c:\_indexes
</property>
// execute the search
Code:
@SuppressWarnings("unchecked")
private List<Curriculo> pesquisar(String[] campos, String strQuery) {
luceneSession = Search.createFullTextSession(session);
MultiFieldQueryParser parser = new MultiFieldQueryParser(campos, new StandardAnalyzer());
try {
luceneQuery = parser.parse(strQuery);
} catch (ParseException e) {
e.printStackTrace();
}
fullTextQuery = luceneSession.createFullTextQuery(luceneQuery, Curriculo.class);
System.out.println(fullTextQuery.toString());
List<Curriculo> lista = new ArrayList<Curriculo>();
try {
lista = fullTextQuery.list(); // * E R R O R *
} catch (Exception ex) {
ex.getMessage();
ex.printStackTrace();
}
return lista;
}
the full stack trace
Code:
java.lang.NullPointerException
at org.hibernate.search.util.ContextHelper.getSearchFactoryBySFI(ContextHelper.java:23)
at org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:228)
at br.com.gtcon.jbancotalentos.jsf.managedbeans.admin.BuscaCurriculo.pesquisar(BuscaCurriculo.java:90)
at br.com.gtcon.jbancotalentos.jsf.managedbeans.admin.BuscaCurriculo.montarQuery(BuscaCurriculo.java:244)
at br.com.gtcon.jbancotalentos.jsf.managedbeans.admin.BuscaCurriculo.buscar(BuscaCurriculo.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:71)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:95)
at javax.faces.component.UICommand.broadcast(UICommand.java:384)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:317)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:292)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:249)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:462)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
FullTextQueryImpl(minicurriculo:computação outrasNecessidadesEspeciais:computação experienciasProfissionais.descricao:computação experienciasProfissionais.empresa:computação experienciasProfissionais.cargo:computação habilidade.descricao:computação habilidadesNaoCadastradas.habilidadeNaoCadastrada:computação certificacoes.descricao:computação formacoesAcademicas.instituicao:computação formacoesAcademicas.curso:computação minicurriculo:informação outrasNecessidadesEspeciais:informação experienciasProfissionais.descricao:informação experienciasProfissionais.empresa:informação experienciasProfissionais.cargo:informação habilidade.descricao:informação habilidadesNaoCadastradas.habilidadeNaoCadastrada:informação certificacoes.descricao:informação formacoesAcademicas.instituicao:informação formacoesAcademicas.curso:informação)
java.lang.NullPointerException
at org.hibernate.search.util.ContextHelper.getSearchFactoryBySFI(ContextHelper.java:23)
at org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:228)
at br.com.gtcon.jbancotalentos.jsf.managedbeans.admin.BuscaCurriculo.pesquisar(BuscaCurriculo.java:90)
at br.com.gtcon.jbancotalentos.jsf.managedbeans.admin.BuscaCurriculo.buscar(BuscaCurriculo.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:71)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:95)
at javax.faces.component.UICommand.broadcast(UICommand.java:384)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:317)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:292)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:249)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:462)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
I´m using apache-tomcat 6.0.18, hibernate-distribution-3.3.1.GA, hibernate-annotations-3.4.0.GA and hibernate-search-3.0.1.GA
PS: sorry for my "bad" english
Thanks!