DataStax Help Center

Solr core creation results in exception "Error in xpath:/schema/@version for schema"

Summary

This article discusses how to resolve an issue relating to a failure to create Solr cores.

Symptoms

When attempting to create a Solr core in DataStax Enterprise, the attempt results in an HTTP error 500 with the following XML response:

<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">500</int>
<int name="QTime">440</int>
</lst>
<lst name="error">
<str name="msg">Error in xpath:/schema/@version for schema</str>
<str name="trace">org.apache.solr.common.SolrException: Error in xpath:/schema/@version for schema
...exception stack trace...</str>
<int name="code">500</int>
</lst>
<str name="params">name=KS.CF&amp;distributed=true&amp;action=CREATE</str>
</response>

Here is an example of the accompanying exception stack trace:

at org.apache.solr.core.Config.getNode(Config.java:265) 
at org.apache.solr.core.Config.getNode(Config.java:228) 
at org.apache.solr.core.Config.getVal(Config.java:362) 
at org.apache.solr.core.Config.get(Config.java:381) 
at com.datastax.bdp.search.solr.IndexSchemaValidator.validateSchemaVersion(IndexSchemaValidator.java:55) 
at com.datastax.bdp.search.solr.IndexSchemaValidator.validateSchema(IndexSchemaValidator.java:44) 
at com.datastax.bdp.search.solr.CassandraIndexSchema.validateSchema(CassandraIndexSchema.java:131) 
at com.datastax.bdp.search.solr.CassandraIndexSchema.readSchema(CassandraIndexSchema.java:84) 
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:168) 
at com.datastax.bdp.search.solr.CassandraIndexSchema.<init>(CassandraIndexSchema.java:64) 
at com.datastax.bdp.search.solr.core.CassandraCoreContainer.create(CassandraCoreContainer.java:236) 
at com.datastax.bdp.search.solr.core.SolrCoreResourceManager.createCore(SolrCoreResourceManager.java:287) 
at com.datastax.bdp.search.solr.handler.admin.CassandraCoreAdminHandler.handleCreateAction(CassandraCoreAdminHandler.java:134) 
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:102) 
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:221) 
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:106) 
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:744) 
Caused by: java.lang.RuntimeException: schema missing /schema/@version 
at org.apache.solr.core.Config.getNode(Config.java:244)
...

NOTE: The line numbers above relate to DSE 4.6.5 and may differ depending on the DSE version of the cluster.

Cause

In Solr schema version 1.0, all fields are marked as multivalued but the uniqueKey field cannot be multivalued and so throws an error.

This issue was fixed in DSE 4.6.2 (internal defect ID DSP-4421) where schema versions are now validated to ensure that schemas are coded in versions 1.1 (or later).

In the exception above, the validation throws an error when the version of the schema is not specified in schema.xml, for example:

  <schema name="mySchema">
...
</schema>

Workaround

No workaround available. Please see the Solution section below for a permanent fix.

Solution

Since the new schema validation process expects a schema version, you will need to specify one of the valid Solr schema versions:

1.1: multiValued attribute introduced, false by default
1.2: omitTermFreqAndPositions attribute introduced, true by default
     except for text fields.
1.3: removed optional field compress feature
1.4: autoGeneratePhraseQueries attribute introduced to drive
     QueryParser behavior when a single string produces multiple
     tokens. Defaults to off for version >= 1.4
1.5: omitNorms defaults to true for primitive field types
     (int, float, boolean, string...)

So if your schema is version 1.1, update the root node as follows:

  <schema name="mySchema" version="1.1">
...
</schema>

After updating the schema.xml, you should be able to create the core as normal.

As a final note, although this issue applies to Solr instances from DSE versions 4.6.2 and above, it is highly recommended that the schema version is always specified for completeness.

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    Andrew Johnson

    Another fine artwork by Erick Ramirez..

Powered by Zendesk