Create New Core Using C# WinForms

402 views
Skip to first unread message

Kishan Sojitra

unread,
May 11, 2016, 5:16:56 PM5/11/16
to SolrNet

I'm trying to create a core Using SolrNet.
And It is throwing following Error:

<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">400</int><int name="QTime">317</int></lst><lst name="error"><lst name="metadata"><str name="error-class">org.apache.solr.common.SolrException</str><str name="root-error-class">org.apache.solr.core.SolrResourceNotFoundException</str></lst><str name="msg">Error CREATEing SolrCore 'dynamicCore': Unable to create core [dynamicCore] Caused by: Can't find resource 'solrconfig.xml' in classpath or 'C:\solr\server\solr\dynamicCore'</str><int name="code">400</int></lst>
</response>



I have attached my Solution I'm working on.

Or Here is my Code:
         
const string solrUrl = "http://localhost:8980/solr";
Startup.Init<Files>(solrUrl);
var HeaderParser = ServiceLocator.Current.GetInstance<ISolrHeaderResponseParser>();
var StatusParser = ServiceLocator.Current.GetInstance<ISolrStatusResponseParser>();
ISolrCoreAdmin solrCoreAdmin = new SolrCoreAdmin(new SolrConnection(solrUrl), HeaderParser, StatusParser);
           
try
           
{
               
/// Get the status of all registered cores:
               
IList<CoreResult> coreStatus = solrCoreAdmin.Status();


               
/// Get the status of a single core:
               
var coreStatus1 = solrCoreAdmin.Status("core1");
                solrCoreAdmin
.Create(coreName: "dynamicCore", instanceDir: "dynamicCore", configFile: "solrconfig.xml", schemaFile: "managed-schema", dataDir: "data");


               
MessageBox.Show("Done");
           
}
           
catch (Exception ex)
           
{
               
Clipboard.SetText(ex.Message);
               
MessageBox.Show(ex.Message);
           
}

Thanks in Advance.
WorkingWithSolr_WinForms_zip

Mauricio Scheffer

unread,
May 11, 2016, 5:21:30 PM5/11/16
to sol...@googlegroups.com
When creating a core in Solr, the config files must be already available on the server.

Cheers



--
Mauricio

--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrnet+u...@googlegroups.com.
To post to this group, send email to sol...@googlegroups.com.
Visit this group at https://groups.google.com/group/solrnet.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages