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 Clay Fink <fi...@jhuapl.edu> on 2009/04/16 23:25:23 UTC

Re: NPE creating EmbeddedSolrServer

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.