Yes,
Nullpointer Exception. on the line
SolrCore coreToRequest = coreContainer.getCore("core2");
Noble Paul ??????? ?????? wrote:
is there any error on the console?
On Fri, Jun 12, 2009 at 4:26 PM, Noor<noo...@opentechindia.com> wrote:
hi,
i am new to apache solr.
I need to create a custom request handler class. So i create a new one and
changed the solr-config.xml file as,
<requestHandler name="/select" class="solr.my.MyCustomHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="q">tandem</str>
<str name="debugQuery">true</str>
</lst>
</requestHandler>
And in my java class, the code is,
public class MyCustomHandler extends RequestHandlerBase{
public CoreContainer coreContainer;
public void handleRequestBody(SolrQueryRequest request, SolrQueryResponse
response) throws Exception {
SolrCore coreToRequest = coreContainer.getCore("core2");
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("echoParams", "explicit");
params.set("q", "text");
params.set("debugQuery", "true");
request = new LocalSolrQueryRequest(coreToRequest, params);
// SolrRequestHandler reqHandler =
coreToRequest.getRequestHandler("/select");
coreToRequest.execute(reqHandler, request, response);
coreToRequest.close();
request.close();
}
// the abstract methods - getDescription(), getSourceId(), getSource(),
getVersion() are //overrided... but these methods doesn't have any
implementations.
}
But, if i search any text in my webapp from browser, gots the HTTP 500
error.
i dont know how SolrContainer is intialized....
Pls anyone give me the solution...
thanks and regards,
Mohamed