Home » » Solr Error: A SPI class of type org.apache.lucene.index.codecs.Codec with name ‘Lucene40′ does not exist

Solr Error: A SPI class of type org.apache.lucene.index.codecs.Codec with name ‘Lucene40′ does not exist

When you are testing Solr in Eclipse, you may encounter the problem that “A SPI class of type org.apache.lucene.index.codecs.Codec with name ‘Lucene40′ does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath.The current classpath supports the following names: []”
The fast answer to tackle this problem is to add the lucene-core*.jar to the libaries of your project, and make sure that the file /META-INF/services/org.apache.lucene.index.codecs.Codec is included in lucene-core*.jar. 
The problem is caused by the class of java.util.ServiceLoader used in NamedSPILoader of Solr. When ServiceLoader creates a new service provider, it will extract some information from /META-INF/services/org.apache.lucene.index.codecs.Codec. Therefore when you use build classes rather than the lucene-core*.jar file, the needed information can not be obtained. By now, I think you can handle this problem yourself. 
For more information about How ServiceLoader work, please refer to: 

0 Comments:

Popular Posts