diff --git a/src/java/org/apache/solr/core/SolrCore.java b/src/java/org/apache/solr/core/SolrCore.java index 5f2e9b23e16..b7a0c967392 100644 --- a/src/java/org/apache/solr/core/SolrCore.java +++ b/src/java/org/apache/solr/core/SolrCore.java @@ -357,6 +357,9 @@ public final class SolrCore implements SolrInfoMBean { boolean indexExists = dirFile.canRead(); boolean firstTime = dirs.add(dirFile.getCanonicalPath()); boolean removeLocks = solrConfig.getBool("mainIndex/unlockOnStartup", false); + + initDirectoryFactory(); + if (indexExists && firstTime && removeLocks) { // to remove locks, the directory must already exist... so we create it // if it didn't exist already... @@ -378,8 +381,6 @@ public final class SolrCore implements SolrInfoMBean { SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex",getIndexDir(), true, schema, solrConfig.mainIndexConfig); writer.close(); } - - initDirectoryFactory(); } catch (IOException e) { throw new RuntimeException(e);