lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Daubman <daub...@gmail.com>
Subject Re: What would cause: "SEVERE: java.lang.ClassCastException: com.company.MyCustomTokenizerFactory cannot be cast to org.apache.solr.analysis.TokenizerFactory"
Date Sat, 09 Jun 2012 04:35:25 GMT
Just in case it is helpful, here are the relevant pieces of my schema.xml:

---snip--
        <fieldtype name="customfield" class="solr.TextField"
positionIncrementGap="100">
            <analyzer type="index">
                <tokenizer class="com.company.MyCustomTokenizerFactory"/>
                <filter class="solr.StandardFilterFactory"/>
                <filter class="solr.ASCIIFoldingFilterFactory"/>
                <filter class="solr.LowerCaseFilterFactory"/>
                <filter class="solr.StopFilterFactory"
words="stopwords.txt" ignoreCase="true"/>
                <!--filter class="solr.EnglishPorterFilterFactory"
protected="protwords.txt"/-->
            </analyzer>
            <analyzer type="query">
                <tokenizer class="solr.KeywordTokenizerFactory"/>
                <filter class="solr.StandardFilterFactory"/>
                <filter class="solr.ASCIIFoldingFilterFactory"/>
                <filter class="solr.LowerCaseFilterFactory"/>
                <filter class="solr.StopFilterFactory"
words="stopwords.txt" ignoreCase="true"/>
                <!--filter class="solr.EnglishPorterFilterFactory"
protected="protwords.txt"/-->
            </analyzer>
        </fieldtype>
---snip---

and

---snip---
        <fieldtype name="customterms" class="solr.TextField"
positionIncrementGap="100">
            <analyzer>
                <tokenizer class="solr.KeywordTokenizerFactory"/>
                <filter class="com.company.MyCustomFilterFactory"/>
                <filter class="solr.StandardFilterFactory"/>
                <filter class="solr.SynonymFilterFactory"
synonyms="synonyms.txt" expand="false"/>
                <filter class="solr.ASCIIFoldingFilterFactory"/>
                <filter class="solr.LowerCaseFilterFactory"/>
                <filter class="solr.PatternReplaceFilterFactory"
pattern="\-" replacement=" " replace="all"/>
                <filter class="solr.PatternReplaceFilterFactory"
pattern="&amp;amp;" replacement="&amp;" replace="all"/>
                <filter class="solr.PatternReplaceFilterFactory"
pattern="\s+" replacement=" " replace="all"/>
                <filter class="solr.TrimFilterFactory"/>
                <filter class="solr.SnowballPorterFilterFactory"
language="English" protected="protwords.txt"/>
            </analyzer>
        </fieldtype>
---snip---

On Sat, Jun 9, 2012 at 12:03 AM, Aaron Daubman <daubman@gmail.com> wrote:

> Greetings,
>
> I am in the process of updating custom code and schema from Solr 1.4 to
> 3.6.0 and have run into the following issue with our two custom Tokenizer
> and Token Filter components.
>
> I've been banging my head against this one for far too long, especially
> since it must be something obvious I'm missing.
>
> I have  custom Tokenizer and Token Filter components along with
> corresponding factories. The code for all looks very similar to the
> Tokenizer and TokenFilter (and Factory) code that is standard with 3.6.0
> (and I have also read through
> http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
>
> I have ensured my custom code is on the classpath, it is
> in ENSolrComponents-1.0-SNAPSHOT-jar-with-dependencies.jar:
> ---output snip---
> Jun 8, 2012 10:41:00 PM org.apache.solr.core.CoreContainer load
> INFO: loading shared library: /opt/test_artists_solr/jetty-solr/lib/en
> Jun 8, 2012 10:41:00 PM org.apache.solr.core.SolrResourceLoader
> replaceClassLoader
> INFO: Adding
> 'file:/opt/test_artists_solr/jetty-solr/lib/en/ENSolrComponents-1.0-SNAPSHOT-jar-with-dependencies.jar'
> to classloader
> Jun 8, 2012 10:41:00 PM org.apache.solr.core.SolrResourceLoader
> replaceClassLoader
> INFO: Adding
> 'file:/opt/test_artists_solr/jetty-solr/lib/en/ENUtil-1.0-SNAPSHOT-jar-with-dependencies.jar'
> to classloader
> Jun 8, 2012 10:41:00 PM org.apache.solr.core.CoreContainer create
> --snip---
>
> After successfully parsing the schema and creating many fields, etc.. the
> following is logged:
> ---snip---
> Jun 8, 2012 10:41:00 PM org.apache.solr.util.plugin.AbstractPluginLoader
> load
> INFO: created : com.company.MyCustomTokenizerFactory
> Jun 8, 2012 10:41:00 PM org.apache.solr.common.SolrException log
> SEVERE: java.lang.ClassCastException: com.company.MyCustomTokenizerFactory
> cannot be cast to org.apache.solr.analysis.TokenizerFactory
> at org.apache.solr.schema.IndexSchema$5.init(IndexSchema.java:966)
>  at
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:148)
> at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:986)
>  at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:60)
> at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:453)
>  at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:433)
> at
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:140)
>  at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:490)
> at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:123)
>  at org.apache.solr.core.CoreContainer.create(CoreContainer.java:481)
> at org.apache.solr.core.CoreContainer.load(CoreContainer.java:335)
>  at org.apache.solr.core.CoreContainer.load(CoreContainer.java:219)
> at
> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161)
>  at
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96)
> at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102)
>  at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> at
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:748)
>  at
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
> at
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1222)
>  at
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676)
> at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:455)
>  at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> at
> org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
>  at
> org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
> at
> org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:491)
>  at
> org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:138)
> at
> org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:142)
>  at
> org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:53)
> at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:604)
>  at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:535)
> at org.eclipse.jetty.util.Scanner.scan(Scanner.java:398)
>  at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:332)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
>  at
> org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:118)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
>  at
> org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:552)
> at
> org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:227)
>  at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> at
> org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:63)
>  at
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:53)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:91)
>  at org.eclipse.jetty.server.Server.doStart(Server.java:260)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
>  at
> org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1215)
> at java.security.AccessController.doPrivileged(Native Method)
>  at
> org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1138)
>
> Jun 8, 2012 10:41:00 PM org.apache.solr.common.SolrException log
> SEVERE: org.apache.solr.common.SolrException: analyzer without class or
> tokenizer & filter list
> at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:990)
>  at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:60)
> at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:453)
>  at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:433)
> at
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:140)
>  at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:490)
> at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:123)
>  at org.apache.solr.core.CoreContainer.create(CoreContainer.java:481)
> at org.apache.solr.core.CoreContainer.load(CoreContainer.java:335)
>  at org.apache.solr.core.CoreContainer.load(CoreContainer.java:219)
> at
> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161)
>  at
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96)
> at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102)
>  at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> at
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:748)
>  at
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
> at
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1222)
>  at
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676)
> at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:455)
>  at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> at
> org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
>  at
> org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
> at
> org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:491)
>  at
> org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:138)
> at
> org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:142)
>  at
> org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:53)
> at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:604)
>  at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:535)
> at org.eclipse.jetty.util.Scanner.scan(Scanner.java:398)
>  at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:332)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
>  at
> org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:118)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
>  at
> org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:552)
> at
> org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:227)
>  at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> at
> org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:63)
>  at
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:53)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:91)
>  at org.eclipse.jetty.server.Server.doStart(Server.java:260)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
>  at
> org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1215)
> at java.security.AccessController.doPrivileged(Native Method)
>  at
> org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1138)
> ---snip---
>
> A little farther down, after more successes, this is logged:
>
> ---snip---
> INFO: created : com.company.MyCustomFilterFactory
> Jun 8, 2012 10:41:00 PM org.apache.solr.common.SolrException log
> SEVERE:
> java.lang.ClassCastException: com.company.MyCustomFilterFactory cannot be
> cast to org.apache.solr.analysis.TokenFilterFactory
>  at org.apache.solr.schema.IndexSchema$6.init(IndexSchema.java:999)
> at
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:148)
>  at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:1017)
> at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:60)
>  at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:453)
> at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:433)
>  at
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:140)
> at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:490)
>  at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:123)
> at org.apache.solr.core.CoreContainer.create(CoreContainer.java:481)
>  at org.apache.solr.core.CoreContainer.load(CoreContainer.java:335)
> at org.apache.solr.core.CoreContainer.load(CoreContainer.java:219)
>  at
> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161)
> at
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96)
>  at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
>  at
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:748)
> at
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
>  at
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1222)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676)
>  at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:455)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
>  at
> org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
> at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
>  at
> org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:491)
> at
> org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:138)
>  at
> org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:142)
> at
> org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:53)
>  at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:604)
> at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:535)
>  at org.eclipse.jetty.util.Scanner.scan(Scanner.java:398)
> at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:332)
>  at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> at
> org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:118)
>  at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> at
> org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:552)
>  at
> org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:227)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
>  at
> org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:63)
> at
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:53)
>  at
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:91)
> at org.eclipse.jetty.server.Server.doStart(Server.java:260)
>  at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1215)
>  at java.security.AccessController.doPrivileged(Native Method)
> at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1138)
> ---snip---
>
> These are the only custom components being used, and both cause the severe
> ClassCastException.
>
> Here's what one of the custom factory classes looks like - super-simple,
> basically identical to baseline code:
> ---snip---
> package com.company;
>
> import org.apache.solr.analysis.BaseTokenizerFactory;
>
> import java.io.Reader;
> import java.util.Map;
>
> public class MyCustomTokenizerFactory extends BaseTokenizerFactory {
>     @Override
>     public void init(Map<String, String> args) {
>         super.init(args);
>     }
>
>     public MyCustomTokenizer create(Reader input) {
>         return new MyCustomTokenizer(input);
>     }
> }
> ---snip---
>
> What am I missing here - what would cause the ClassCastException - my
> custom components look exactly like the baseline components?!?
>
> Thanks again,
>     Aaron
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message