[ https://issues.apache.org/jira/browse/SOLR-721?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro updated SOLR-721: ------------------------------- Description: It might be initialized in such a way that no core container is created. Adding the proper includes & a member: {code} final CoreContainer cores; {code} And modifying the constructor: {code} public DirectSolrConnection( String instanceDir, String dataDir, String loggingPath ) { // If a loggingPath is specified, try using that (this needs to happen first) if( loggingPath != null ) { File loggingConfig = new File( loggingPath ); if( !loggingConfig.exists() && instanceDir != null ) { loggingConfig = new File( new File(instanceDir), loggingPath ); } if( loggingConfig.exists() ) { System.setProperty("java.util.logging.config.file", loggingConfig.getAbsolutePath() ); } else { throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "can not find logging file: "+loggingConfig ); } } // Initialize CoreContainer try { cores = new CoreContainer(new SolrResourceLoader(SolrResourceLoader.locateInstanceDir())); SolrConfig solrConfig = new SolrConfig(instanceDir, SolrConfig.DEFAULT_CONF_FILE, null); CoreDescriptor dcore = new CoreDescriptor(cores, "", solrConfig.getResourceLoader().getInstanceDir()); IndexSchema indexSchema = new IndexSchema(solrConfig, instanceDir+"/conf/schema.xml", null); core = new SolrCore( null, dataDir, solrConfig, indexSchema, dcore); cores.register("", core, false); parser = new SolrRequestParsers( config ); } catch (Exception ee) { throw new RuntimeException(ee); } } {code} Should take care of this case. was: It might be initialized in such a way that no core container is created. Adding the proper includes & a member: {code} final CoreContainer cores; {code} And modifying the constructor: {code} public DirectSolrConnection( String instanceDir, String dataDir, String loggingPath ) { // If a loggingPath is specified, try using that (this needs to happen first) if( loggingPath != null ) { File loggingConfig = new File( loggingPath ); if( !loggingConfig.exists() && instanceDir != null ) { loggingConfig = new File( new File(instanceDir), loggingPath ); } if( loggingConfig.exists() ) { System.setProperty("java.util.logging.config.file", loggingConfig.getAbsolutePath() ); } else { throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "can not find logging file: "+loggingConfig ); } } // Initialize SolrConfig SolrConfig config = null; try { cores = new CoreContainer(new SolrResourceLoader(SolrResourceLoader.locateInstanceDir())); SolrConfig solrConfig = new SolrConfig(instanceDir, SolrConfig.DEFAULT_CONF_FILE, null); CoreDescriptor dcore = new CoreDescriptor(cores, "", solrConfig.getResourceLoader().getInstanceDir()); IndexSchema indexSchema = new IndexSchema(solrConfig, instanceDir+"/conf/schema.xml", null); core = new SolrCore( null, dataDir, solrConfig, indexSchema, dcore); cores.register("", core, false); parser = new SolrRequestParsers( config ); } catch (Exception ee) { throw new RuntimeException(ee); } } {code} Should take care of this case. > DirectSolrConnection is broken - missing CoreContainer initialization > --------------------------------------------------------------------- > > Key: SOLR-721 > URL: https://issues.apache.org/jira/browse/SOLR-721 > Project: Solr > Issue Type: Bug > Affects Versions: 1.3 > Reporter: Henri Biestro > Fix For: 1.4 > > > It might be initialized in such a way that no core container is created. > Adding the proper includes & a member: > {code} > final CoreContainer cores; > {code} > And modifying the constructor: > {code} > public DirectSolrConnection( String instanceDir, String dataDir, String > loggingPath ) > { > // If a loggingPath is specified, try using that (this needs to happen > first) > if( loggingPath != null ) { > File loggingConfig = new File( loggingPath ); > if( !loggingConfig.exists() && instanceDir != null ) { > loggingConfig = new File( new File(instanceDir), loggingPath ); > } > if( loggingConfig.exists() ) { > System.setProperty("java.util.logging.config.file", > loggingConfig.getAbsolutePath() ); > } > else { > throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "can > not find logging file: "+loggingConfig ); > } > } > > // Initialize CoreContainer > try { > cores = new CoreContainer(new > SolrResourceLoader(SolrResourceLoader.locateInstanceDir())); > SolrConfig solrConfig = new SolrConfig(instanceDir, > SolrConfig.DEFAULT_CONF_FILE, null); > CoreDescriptor dcore = new CoreDescriptor(cores, "", > solrConfig.getResourceLoader().getInstanceDir()); > IndexSchema indexSchema = new IndexSchema(solrConfig, > instanceDir+"/conf/schema.xml", null); > core = new SolrCore( null, dataDir, solrConfig, indexSchema, dcore); > cores.register("", core, false); > parser = new SolrRequestParsers( config ); > } > catch (Exception ee) { > throw new RuntimeException(ee); > } > } > {code} > Should take care of this case. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.