title: Solr schema "Already closed" and related errors after base DSE/Solr Node setup
body: <p>Getting started with DSE Solr nodes, initial setup fine and was able to follow this example with no issues:</p>
  
  <p><a href="http://www.datastax.com/documentation/datastax_enterprise/4.5/datastax_enterprise/srch/srchTutStrt.html" rel="nofollow">http://www.datastax.com/documentation/datastax_enterprise/4.5/datastax_enterprise/srch/srchTutStrt.html</a></p>
  
  <p>My first test use case is some example location data, modifying the tutorial example.  I am now at a state where I can create my table, insert ~5K example rows, and when pushing the schema get the following exception:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;response&gt;
      &lt;lst name="responseHeader"&gt;&lt;int name="status"&gt;500&lt;/int&gt;&lt;int name="QTime"&gt;245&lt;/int&gt;&lt;/lst&gt;&lt;lst name="error"&gt;&lt;str name="msg"&gt;Already closed&lt;/str&gt;&lt;str name="trace"&gt;org.apache.solr.common.SolrException: Already closed
      at org.apache.solr.core.SolrCore.&amp;lt;init&amp;gt;(SolrCore.java:851)
      at com.datastax.bdp.search.solr.core.CassandraCoreContainer.doReload(CassandraCoreContainer.java:700)
      at com.datastax.bdp.search.solr.core.CassandraCoreContainer.create(CassandraCoreContainer.java:224)
      at com.datastax.bdp.search.solr.core.SolrCoreResourceManager.createCore(SolrCoreResourceManager.java:256)
      at com.datastax.bdp.search.solr.handler.admin.CassandraCoreAdminHandler.handleCreateAction(CassandraCoreAdminHandler.java:117)
      at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:152)
      at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:137)
      at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:669)
      at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:248)
      at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:197)
      at com.datastax.bdp.search.solr.servlet.CassandraDispatchFilter.doFilter(CassandraDispatchFilter.java:99)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at com.datastax.bdp.cassandra.audit.SolrHttpAuditLogFilter.doFilter(SolrHttpAuditLogFilter.java:218)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at com.datastax.bdp.search.solr.auth.CassandraAuthorizationFilter.doFilter(CassandraAuthorizationFilter.java:100)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at com.datastax.bdp.search.solr.auth.DseAuthenticationFilter.doFilter(DseAuthenticationFilter.java:102)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:891)
      at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:750)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2283)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Caused by: org.apache.lucene.store.AlreadyClosedException: Already closed
          at org.apache.solr.core.CachingDirectoryFactory.get(CachingDirectoryFactory.java:340)
          at org.apache.solr.core.SolrCore.getNewIndexDir(SolrCore.java:262)
          at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:480)
          at org.apache.solr.core.SolrCore.&lt;init&gt;(SolrCore.java:772)
          ... 33 more
      500name=snet_data.location_test1&amp;action=CREATE
      </p>
  
  <p>Using this as my table create statement:</p>
  
  <pre><code>CREATE table location_test1 (
  "id" TIMEUUID,
  "source_id" UUID,
  "name" VARCHAR,
  "address" VARCHAR,
  "address_extended" VARCHAR,
  "po_box" VARCHAR,
  "locality" VARCHAR,
  "region" VARCHAR,
  "post_town" VARCHAR,
  "admin_region" VARCHAR,
  "postcode" VARCHAR,
  "country" VARCHAR,
  "tel" VARCHAR,
  "latlon" VARCHAR,
  "neighborhood" SET&lt;VARCHAR&gt;,
  "website" VARCHAR,
  "email" VARCHAR,
  "category_ids" SET&lt;VARCHAR&gt;,
  "status" VARCHAR,
  "chain_name" VARCHAR,
  "chain_id" UUID,
  PRIMARY KEY ("id"));
  </code></pre>
  
  <p>With the solr schema:</p>
  
  <pre><code>&lt;schema name="location_test1" version="1.5"&gt;
   &lt;types&gt;
    &lt;fieldType name="string" class="solr.StrField"/&gt;
    &lt;fieldType name="text" class="solr.TextField"&gt;
      &lt;analyzer&gt;
          &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
          &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
        &lt;/analyzer&gt;
    &lt;/fieldType&gt;
    &lt;fieldType name="geo" class="solr.GeoHashField"/&gt;
    &lt;fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0" /&gt;
    &lt;fieldType name="int" class="solr.TrieIntField"/&gt;
    &lt;fieldType name="uuid" class="solr.UUIDField"/&gt;
   &lt;/types&gt;
   &lt;fields&gt;
     &lt;field name="id" type="uuid" indexed="true"  stored="true" docValues="true"/&gt;
     &lt;field name="name" type="string" indexed="true"  stored="true"/&gt;
     &lt;field name="latlon" type="geo" indexed="true"  stored="true"/&gt;
  &lt;/fields&gt;
  &lt;defaultSearchField&gt;name&lt;/defaultSearchField&gt;
  &lt;uniqueKey&gt;(id)&lt;/uniqueKey&gt;
  &lt;/schema&gt;
  </code></pre>
  
  <p>UPDATED (10/29) after new tests</p>
  
  <p>So after seeming like these errors are being caused b/c DSE Solr is in some bad state, even after dropping table and data and starting over, I decided to drop the entire keyspace as the restart point.  Getting different behavior now.., consistent with earlier errors where on core creation it complains that a multi-value field should be mapped to List/Set type.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;response&gt;
  &lt;lst name="responseHeader"&gt;&lt;int name="status"&gt;500&lt;/int&gt;&lt;int name="QTime"&gt;325&lt;/int&gt;&lt;/lst&gt;&lt;lst name="error"&gt;&lt;str name="msg"&gt;Unable to create core: snet_data.location_test1&lt;/str&gt;&lt;str name="trace"&gt;org.apache.solr.common.SolrException: Unable to create core: snet_data.location_test1
          at org.apache.solr.core.CoreContainer.recordAndThrow(CoreContainer.java:957)
          at com.datastax.bdp.search.solr.core.CassandraCoreContainer.create(CassandraCoreContainer.java:266)
          at com.datastax.bdp.search.solr.core.SolrCoreResourceManager.createCore(SolrCoreResourceManager.java:256)
          at com.datastax.bdp.search.solr.handler.admin.CassandraCoreAdminHandler.handleCreateAction(CassandraCoreAdminHandler.java:117)
          at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:152)
          at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:137)
          at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:669)
          at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:248)
          at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:197)
          at com.datastax.bdp.search.solr.servlet.CassandraDispatchFilter.doFilter(CassandraDispatchFilter.java:99)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at com.datastax.bdp.cassandra.audit.SolrHttpAuditLogFilter.doFilter(SolrHttpAuditLogFilter.java:218)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at com.datastax.bdp.search.solr.auth.CassandraAuthorizationFilter.doFilter(CassandraAuthorizationFilter.java:100)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at com.datastax.bdp.search.solr.auth.DseAuthenticationFilter.doFilter(DseAuthenticationFilter.java:102)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
          at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:891)
          at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:750)
          at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2283)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.IllegalStateException: Multi-valued field status should be mapped to either List or Set types, found: org.apache.cassandra.db.marshal.UTF8Type
          at com.datastax.bdp.search.solr.core.Cql3CassandraSolrSchemaUpdater.update(Cql3CassandraSolrSchemaUpdater.java:115)
          at com.datastax.bdp.search.solr.core.CassandraCoreContainer.create(CassandraCoreContainer.java:245)
          ... 31 more
  &lt;/str&gt;&lt;int name="code"&gt;500&lt;/int&gt;&lt;/lst&gt;&lt;str name="params"&gt;name=snet_data.location_test1&amp;amp;action=CREATE&lt;/str&gt;
  &lt;/response&gt;
  </code></pre>
  
  <p>Just like before with other field errors, the status field it's complaining about is defined in the table as a varchar, and in the schema as a string, so not quite sure why it complains about these.</p>
  
  <p>What I have done now is stripped the schema down to just id,name,latlon.  Back to where I don't get the multi-value errors on single value varchar/string fields.., back to original "Already Closed" error</p>
  
  <p>Here are my curl statements, built from example referenced above from datastax solr tutorial:</p>
  
  <pre><code>curl http://10.0.1.212:8983/solr/resource/snet_data.location_test1/solrconfig.xml --data-binary @solrconfig.xml -H 'Content-type:text/xml; charset=utf-8'
  
  curl http://10.0.1.212:8983/solr/resource/snet_data.location_test1/schema.xml --data-binary @schema.xml -H 'Content-type:text/xml; charset=utf-8'
  
  curl "http://10.0.1.212:8983/solr/admin/cores?action=CREATE&amp;name=snet_data.location_test1"
  </code></pre>
  
  <p>Steps Taken in running setup tests:</p>
  
  <p>Log into cql shell and do following</p>
  
  <p>Create keyspace:</p>
  
  <pre><code>CREATE KEYSPACE snet_data WITH REPLICATION =
         {'class':'NetworkTopologyStrategy', 'Solr':1};
  </code></pre>
  
  <p>Create table:</p>
  
  <pre><code>CREATE table location_test1 (
  "id" TIMEUUID,
  "source_id" UUID,
  "name" VARCHAR,
  "address" VARCHAR,
  "address_extended" VARCHAR,
  "po_box" VARCHAR,
  "locality" VARCHAR,
  "region" VARCHAR,
  "post_town" VARCHAR,
  "admin_region" VARCHAR,
  "postcode" VARCHAR,
  "country" VARCHAR,
  "tel" VARCHAR,
  "latlon" VARCHAR,
  "neighborhood" SET&lt;VARCHAR&gt;,
  "website" VARCHAR,
  "email" VARCHAR,
  "category_ids" SET&lt;VARCHAR&gt;,
  "status" VARCHAR,
  "chain_name" VARCHAR,
  "chain_id" UUID,
  PRIMARY KEY ("id"));
  </code></pre>
  
  <p>(tried both importing test of 5k records like tutorial, also running solr curl commands sans inserting initial data)</p>
  
  <p>Run solr curl commands to setup config, schema, core:</p>
  
  <pre><code>curl http://10.0.1.212:8983/solr/resource/snet_data.location_test1/solrconfig.xml --data-binary @solrconfig.xml -H 'Content-type:text/xml; charset=utf-8'
  
  curl http://10.0.1.212:8983/solr/resource/snet_data.location_test1/schema.xml --data-binary @schema.xml -H 'Content-type:text/xml; charset=utf-8'
  
  curl "http://10.0.1.212:8983/solr/admin/cores?action=CREATE&amp;name=snet_data.location_test1"
  </code></pre>