Hi,

 

To me this looks like the implementing class is not a real subclass of 
org.apache.lucene.codecs.Codec – because you said “PostingsFormat” not “Codec” 
in your mail? If you just want to create your own PostingsFormat, you have to 
put it into the other META-INF file for 
org.apache.lucene.codecs.PostingsFormats. Creating own codecs is in most cases 
not needed, most people are only interested in postings formats.

 

Another reason for this could be that the JAR file with the codec is in a 
different classloader than the one of lucene-core.jar.

 

Uwe

 

-----

Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen

 <http://www.thetaphi.de/> http://www.thetaphi.de

eMail: [email protected]

 

From: Tom Burton-West [mailto:[email protected]] 
Sent: Friday, March 13, 2015 4:25 PM
To: [email protected]
Cc: Noah Botimer
Subject: Custom PostingsFormat SPILoader issues

 

Hello,

 

I'm trying to configure Solr to use a custom Postings Format using the 
SPILoader.

 

I specified my custom postings format in the  schema.xml file:

 

<fieldType name="text_general" class="solr.TextField" 
positionIncrementGap="100"  postingsFormat="HTPostingsFormatWrapper">

 

Then  I created a custom postings format class (its actually a simple wrapper 
class), compiled a jar and included an org.apache.lucene.codecs.Codec file in 
META-INF/services in the jar file with an entry for the wrapper class 
:HTPostingsFormatWrapper.   I created a collection1/lib directory and put the 
jar there. (see below)

 

I'm getting a  "ClassCastException Class.asSubclass(Unknown Source" error (See 
below).

 

My first thought is that maybe putting a plugin class in collection1/lib is no 
longer the best option and something about the order of loading classes is 
causing a problem.     

 

Any suggestions on how to troubleshoot this?.  

 

For background see this thread on the Solr mailing 
list:http://lucene.472066.n3.nabble.com/How-to-configure-Solr-PostingsFormat-block-size-tt4179029.html

 

 

Tom

 

--------------------

 

error:

by: java.lang.ClassCastException: class 
org.apache.lucene.codecs.HTPostingsFormatWrapper

 at java.lang.Class.asSubclass(Unknown Source)

 at org.apache.lucene.util.SPIClassIterator.next(SPIClassIterator.java:141)

 

 

-------------------

Contents of the jar file:

 

C:\d\solr\lucene_solr_4_10_2\solr\example\solr\collection1\lib>jar -tvf 
HTPostingsFormatWrapper.jar

    25 Thu Mar 12 10:37:04 EDT 2015 META-INF/MANIFEST.MF

  1253 Thu Mar 12 10:37:04 EDT 2015 
org/apache/lucene/codecs/HTPostingsFormatWrapper.class

  1276 Thu Mar 12 10:49:06 EDT 2015 
META-INF/services/org.apache.lucene.codecs.Codec

 

 

 

----------------

Contents of  META-INF/services/org.apache.lucene.codecs.Codec in the jar file: 

org.apache.lucene.codecs.lucene49.Lucene49Codec

org.apache.lucene.codecs.lucene410.Lucene410Codec

# tbw adds custom wrapper here per Hoss e-mail

org.apache.lucene.codecs.HTPostingsFormatWrapper

 

-------------------------

log file excerpt with stack trace:

 

12821 [main] INFO  org.apache.solr.core.CoresLocator  – Looking for core 
definitions underneath C:\d\solr\lucene_solr_4_10_2\solr\example\solr

12838 [main] INFO  org.apache.solr.core.CoresLocator  – Found core collection1 
in C:\d\solr\lucene_solr_4_10_2\solr\example\solr\collection1\

12839 [main] INFO  org.apache.solr.core.CoresLocator  – Found 1 core definitions

12841 [coreLoadExecutor-5-thread-1] INFO  
org.apache.solr.core.SolrResourceLoader  – new SolrResourceLoader for 
directory: 'C:\d\solr\lucene_solr_4_10_2\solr\example\solr\collection1\'

12842 [coreLoadExecutor-5-thread-1] INFO  
org.apache.solr.core.SolrResourceLoader  – Adding 
'file:/C:/d/solr/lucene_solr_4_10_2/solr/example/solr/collection1/lib/HTPostingsFormatWrapper.jar'
 to classloader

12870 [coreLoadExecutor-5-thread-1] ERROR org.apache.solr.core.CoreContainer  – 
Error creating core [collection1]: class 
org.apache.lucene.codecs.HTPostingsFormatWrapper

java.lang.ClassCastException: class 
org.apache.lucene.codecs.HTPostingsFormatWrapper

at java.lang.Class.asSubclass(Unknown Source)

at org.apache.lucene.util.SPIClassIterator.next(SPIClassIterator.java:141)

at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:65)

at org.apache.lucene.codecs.Codec.reloadCodecs(Codec.java:119)

at 
org.apache.solr.core.SolrResourceLoader.reloadLuceneSPI(SolrResourceLoader.java:206)

at org.apache.solr.core.SolrResourceLoader.<init>(SolrResourceLoader.java:142)

at 
org.apache.solr.core.ConfigSetService$Default.createCoreResourceLoader(ConfigSetService.java:144)

at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:58)

        at org.apache.solr.core.CoreContainer.create(CoreContainer.java:489)

at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:255)

at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:249)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

 

Reply via email to