lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S├ębastien Rainville" <sebastienrainvi...@gmail.com>
Subject Re: Using custom Similarity class
Date Thu, 17 Jul 2008 15:21:23 GMT
Thanks for the tip but I solved it but using the old way of loading custom
libs into solr: unpack the war file, add the custom library to WEB-INF/lib
and repack it. It definetly is a class loader problem, as the wiki specifies
that the new way of loading custom jars is using a custom class loader that
*might* not work...

Sebastien




On Thu, Jul 17, 2008 at 10:35 AM, Koji Sekiguchi <koji@r.email.ne.jp> wrote:

> > 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message