Hi 

I am very new with Solr, infact just started today so forgive my lack of
knowledge on the subject.

Everything went fine until the point where I started to get the exception
"Exception in thread "main" org.apache.solr.common.SolrException: No such
core: core1" and I am stuck at the same point for a couple of hours now.

*Below is the test code :*

public class UtilSolR {

  private static EmbeddedSolrServer embeddedSolrServer = null;

  private static SolrServer httpSolrServer = null;

  /**
   * @param args
   */
  public static void main(String[] args) {
//    SolrServer server = getHttpSolRServer();
    SolrServer server = getEmbeddedSolRServer();

    SolrInputDocument doc1 = new SolrInputDocument();
    doc1.addField("tenant_id", "tenant_id", 1.0f);
    doc1.addField("displayas", "displayas", 1.0f);
    doc1.addField("btel", "btel", 1.0f);
    doc1.addField("htel", "htel", 1.0f);

//    SolrInputDocument doc2 = new SolrInputDocument();
//    doc2.addField( "id", "id2", 1.0f );
//    doc2.addField( "name", "doc2", 1.0f );
//    doc2.addField( "price", 20 );

    Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
    docs.add( doc1 );
//    docs.add( doc2 );

    try {
      server.add( docs );

      server.commit();
    } catch (SolrServerException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    System.out.println("Done !!");
  }

  public static EmbeddedSolrServer getEmbeddedSolRServer(){
    if(embeddedSolrServer == null){
      CoreContainer coreContainer;
      System.setProperty("solr.solr.home",
"/home/automata/solr/apache-solr-3.3.0/example/solr/");
      CoreContainer.Initializer initializer = new
CoreContainer.Initializer();
      try {
        coreContainer = initializer.initialize();
        embeddedSolrServer = new EmbeddedSolrServer(coreContainer, "");
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (ParserConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (SAXException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    return embeddedSolrServer;
  }

 }



*The solr.xml file is as follows :*

<solr persistent="false">



  

  <cores adminPath="/admin/cores" defaultCoreName="collection1">

    <core name="collection1" instanceDir="." />

    <core name="core1" instanceDir="core1" />

  </cores>

</solr>


The structure of the example folder is standard(just as the supplied one
from apache) and no change has been made to it.


The solar  interface doesnt mention any core names there, however does not
throw a 404 on opening the admin page.

Any help to resolve the problem will be really great. Please let me know if
I can provide any more information.

thanks !




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Exception-in-thread-main-org-apache-solr-common-SolrException-No-such-core-core1-tp3206610p3206610.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to