lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Koji Sekiguchi <k...@r.email.ne.jp>
Subject Re: Using custom Similarity class
Date Thu, 17 Jul 2008 14:35:07 GMT
 > com.example.CustomSimilarity cannot be cast to
 > org.apache.lucene.search.Similarity
 > at org.apache.solr.schema.IndexSchema.readConfig(IndexSchema.java:449)
 > ... 28 more

I think you've got a class loader problem.
If you have solr-1.2.0 source code, see the line 499 of IndexSchema.java:

      similarity = 
(Similarity)Config.newInstance(node.getNodeValue().trim());

Change the line to:

Object o = Config.newInstance(node.getNodeValue().trim());
System.err.println("(1) The object " + o + " classloader is " + 
o.getClass().getClassLoader());
System.err.println("(2) Class Similarity class loader is " + 
Similarity.class.getClassLoader());
similarity = (Similarity) o;

You will see different classloader between (1) and (2).
I'm not familiar with jetty classloader, but you can
google "jetty classloader" to get a solution.

Cheers,

Koji


Mime
View raw message