On 9/24/2013 6:32 PM, Scott Schneider wrote:
> I created my own codec and Solr can find it sometimes and not other times.  
> When I start fresh (delete the data folder and run Solr), it all works fine.  
> I can add data and query it.  When I stop Solr and start it again, I get:
> 
> Caused by: java.lang.IllegalArgumentException: A SPI class of type 
> org.apache.lucene.codecs.Codec with name 'MyCodec' does not exist. You need 
> to add the corresponding JAR file supporting this SPI to your classpath.The 
> current classpath supports the following names: [SimpleText, Appending, 
> Lucene40, Lucene3x, Lucene41, Lucene42]
> 
> I added the JAR to the path and I'm pretty sure Java sees it, or else it 
> would not be using my codec when I start fresh.  (I've looked at the index 
> files and verified that it's using my codec.)  I suppose Solr is asking SPI 
> for my codec based on the codec class name stored in the index files, but I 
> don't see why this would fail when a fresh start works.

What I always recommend for those who want to use custom and contrib
jars is that they put all such jars (and their dependencies) into
${solr.solr.home}/lib, don't use any <lib> directives in solrconfig.xml,
and don't put the sharedLib attribute into solr.xml.  Doing it in any
other way has a tendency to trigger bugs or causes jars to get loaded
more than once.

The ${solr.solr.home} property defaults to $CWD/solr (CWD is current
working directory for those who don't already know) and is the location
of the solr.xml file.  Note that depending on the exact version of Solr
and which servlet container you are using, there may actually be two
solr.xml files, one which loads solr into your container and one that
configures Solr.  I am referring to the latter.

If you are using the solr example and its directory layout, the
directory you would need to put all jars into is example/solr/lib ...
which is a directory that doesn't exist and has to be created.

http://wiki.apache.org/solr/Solr.xml%20%28supported%20through%204.x%29
http://wiki.apache.org/solr/Solr.xml%204.4%20and%20beyond

Thanks,
Shawn

Reply via email to