[ https://issues.apache.org/jira/browse/SOLR-736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro updated SOLR-736: ------------------------------- Description: The method is deprecated but one can still initialize & start working this way. Potential fix could be: {code} @Deprecated public static SolrCore getSolrCore() { synchronized( SolrCore.class ) { if( instance == null ) { try { // sets 'instance' to the latest solr core CoreContainer.Initializer init = new CoreContainer.Initializer(); instance = init.initialize().getCore(""); } catch(Exception xany) { throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "error creating core", xany ); } } } return instance; } {code} was: The method is deprecated but one can still initialize & start working this way. Potential fix could be: {code} @Deprecated public static SolrCore getSolrCore() { synchronized( SolrCore.class ) { if( instance == null ) { try { // sets 'instance' to the latest solr core final SolrConfig solrConfig = new SolrConfig(); final IndexSchema indexSchema = new IndexSchema(solrConfig, "schema.xml", null); CoreContainer.Initializer init = new CoreContainer.Initializer() { @Override public CoreContainer initialize() { CoreContainer container = new CoreContainer(new SolrResourceLoader(SolrResourceLoader.locateInstanceDir())); CoreDescriptor dcore = new CoreDescriptor("", solrConfig.getResourceLoader().getInstanceDir()); dcore.setCoreContainer(container); dcore.setConfigName(solrConfig.getResourceName()); dcore.setSchemaName(indexSchema.getResourceName()); SolrCore core = new SolrCore(null, null, solrConfig, indexSchema, dcore); container.register(null, core, false); return container; } }; instance = init.initialize().getCore(""); } catch(Exception xany) { throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "error creating core", xany ); } } } return instance; } {code} > SolrCore.getSolrCore() may create a SolrCore without a CoreContainer > -------------------------------------------------------------------- > > Key: SOLR-736 > URL: https://issues.apache.org/jira/browse/SOLR-736 > Project: Solr > Issue Type: Bug > Affects Versions: 1.3 > Reporter: Henri Biestro > > The method is deprecated but one can still initialize & start working this > way. > Potential fix could be: > {code} > @Deprecated > public static SolrCore getSolrCore() { > synchronized( SolrCore.class ) { > if( instance == null ) { > try { > // sets 'instance' to the latest solr core > CoreContainer.Initializer init = new CoreContainer.Initializer(); > instance = init.initialize().getCore(""); > } catch(Exception xany) { > throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, > "error creating core", xany ); > } > } > } > return instance; > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.