You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Alexandre Rafalovitch <ar...@gmail.com> on 2009/03/17 23:22:11 UTC
NPE creating EmbeddedSolrServer
Hello,
I am trying to create a basic single-core embedded Solr instance. I
figured out how to setup a single core instance and got (I believe)
all files in right places. However, I am unable to run trivial code
without exception:
SolrServer solr = new EmbeddedSolrServer(
new CoreContainer(
"D:\\Projects\\FutureTerm\\apache-solr-1.3.0\\futureterm",
new
File("D:\\Projects\\FutureTerm\\apache-solr-1.3.0\\futureterm\\solr.xml")),
"core");
The exception (with context) is:
WARNING: No queryConverter defined, using default converter
Mar 17, 2009 6:15:01 PM org.apache.solr.core.QuerySenderListener newSearcher
INFO: QuerySenderListener sending requests to Searcher@b02928 main
Mar 17, 2009 6:15:01 PM org.apache.solr.common.SolrException log
SEVERE: java.lang.NullPointerException
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:147)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1204)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1228)
at org.apache.solr.core.QuerySenderListener.newSearcher(QuerySenderListener.java:50)
at org.apache.solr.core.SolrCore$4.call(SolrCore.java:1034)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Mar 17, 2009 6:15:02 PM org.apache.solr.core.SolrCore execute
INFO: [core] webapp=null path=null
params={start=0&q=fast_warm&rows=10} status=500 QTime=47
I am not sure where to look further. Source code (at my level of
knowledge) is not very helpful.
Regards,
Alex.
Personal blog: http://blog.outerthoughts.com/
Research group: http://www.clt.mq.edu.au/Research/
Re: NPE creating EmbeddedSolrServer
Posted by Clay Fink <fi...@jhuapl.edu>.
This worked great. Thanks!
The only catch is you have to (eventually) call CoreContainer.shutdown(),
otherwise the app just hangs.
Alexandre Rafalovitch wrote:
>
> To reply to my own message.
>
> The following worked starting from scratch (example):
> ----------------------------------------------------------------------------------------------------
>
> SolrConfig solrConfig = new SolrConfig(
>
> "D:\\Projects\\FutureTerm\\apache-solr-1.3.0\\futureterm\\solr",
> "solrconfig.xml",
> null);
> IndexSchema indexSchema = new IndexSchema(
> solrConfig,
> "schema.xml",
> null);
>
> CoreContainer container = new CoreContainer(new
> SolrResourceLoader(SolrResourceLoader.locateInstanceDir()));
> CoreDescriptor dcore = new CoreDescriptor(container, "",
> solrConfig.getResourceLoader().getInstanceDir());
> dcore.setConfigName(solrConfig.getResourceName());
> dcore.setSchemaName(indexSchema.getResourceName());
> SolrCore core = new SolrCore(
> null,
>
> "D:\\Projects\\FutureTerm\\apache-solr-1.3.0\\futureterm\\solr\\data",
> solrConfig, indexSchema, dcore);
> container.register("", core, false);
> SolrServer server = new EmbeddedSolrServer(container, "");
>
> ----------------------------------------------------------------------------------------------------
>
> Not sure I get the magical sequence yet, but maybe it will save
> somebody else half a day.
>
> Regards,
> Alex.
> Personal blog: http://blog.outerthoughts.com/
> Research group: http://www.clt.mq.edu.au/Research/
>
>
>
> On Tue, Mar 17, 2009 at 6:22 PM, Alexandre Rafalovitch
> <ar...@gmail.com> wrote:
>> Hello,
>>
>> I am trying to create a basic single-core embedded Solr instance. I
>> figured out how to setup a single core instance and got (I believe)
>> all files in right places. However, I am unable to run trivial code
>> without exception:
>
>
--
View this message in context: http://www.nabble.com/NPE-creating-EmbeddedSolrServer-tp22569143p23086774.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: NPE creating EmbeddedSolrServer
Posted by Alexandre Rafalovitch <ar...@gmail.com>.
To reply to my own message.
The following worked starting from scratch (example):
----------------------------------------------------------------------------------------------------
SolrConfig solrConfig = new SolrConfig(
"D:\\Projects\\FutureTerm\\apache-solr-1.3.0\\futureterm\\solr",
"solrconfig.xml",
null);
IndexSchema indexSchema = new IndexSchema(
solrConfig,
"schema.xml",
null);
CoreContainer container = new CoreContainer(new
SolrResourceLoader(SolrResourceLoader.locateInstanceDir()));
CoreDescriptor dcore = new CoreDescriptor(container, "",
solrConfig.getResourceLoader().getInstanceDir());
dcore.setConfigName(solrConfig.getResourceName());
dcore.setSchemaName(indexSchema.getResourceName());
SolrCore core = new SolrCore(
null,
"D:\\Projects\\FutureTerm\\apache-solr-1.3.0\\futureterm\\solr\\data",
solrConfig, indexSchema, dcore);
container.register("", core, false);
SolrServer server = new EmbeddedSolrServer(container, "");
----------------------------------------------------------------------------------------------------
Not sure I get the magical sequence yet, but maybe it will save
somebody else half a day.
Regards,
Alex.
Personal blog: http://blog.outerthoughts.com/
Research group: http://www.clt.mq.edu.au/Research/
On Tue, Mar 17, 2009 at 6:22 PM, Alexandre Rafalovitch
<ar...@gmail.com> wrote:
> Hello,
>
> I am trying to create a basic single-core embedded Solr instance. I
> figured out how to setup a single core instance and got (I believe)
> all files in right places. However, I am unable to run trivial code
> without exception: