[ 
https://issues.apache.org/jira/browse/SOLR-2737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jan H√łydahl closed SOLR-2737.
-----------------------------
    Resolution: Cannot Reproduce

Closing old ancient issue. Likely caused by wrong deploy to Tomcat? We don't 
support Tomcat anymore.

> I get ClassCastException when staring tomcat server (Solr configured with 
> Suggester option enabled)
> ---------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-2737
>                 URL: https://issues.apache.org/jira/browse/SOLR-2737
>             Project: Solr
>          Issue Type: Bug
>          Components: spellchecker
>    Affects Versions: 3.3
>         Environment: Windows 7/Apache Tomcat 7/Solr 3.3/JDK 1.6
>            Reporter: Saurabh Kumar Singh
>
> I get the following stack trace on server startup:
> Aug 30, 2011 6:37:44 PM org.apache.solr.common.SolrException log
> SEVERE: java.lang.ClassCastException: java.lang.String cannot be cast to 
> java.lang.Float
>       at org.apache.solr.spelling.suggest.Suggester.init(Suggester.java:84)
>       at 
> org.apache.solr.handler.component.SpellCheckComponent.inform(SpellCheckComponent.java:597)
>       at 
> org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:522)
>       at org.apache.solr.core.SolrCore.<init>(SolrCore.java:594)
>       at org.apache.solr.core.CoreContainer.create(CoreContainer.java:463)
>       at org.apache.solr.core.CoreContainer.load(CoreContainer.java:316)
>       at 
> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:133)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:94)
>       at 
> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
>       at 
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
>       at 
> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
>       at 
> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
>       at 
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4584)
>       at 
> org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5262)
>       at 
> org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5257)
>       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:662)
> Below is the patch for the fix (I did it locally. Please let me know the 
> criteria of how could I check-in the fix :) )
>  ### Eclipse Workspace Patch 1.0
> #P lucene_solr_3_3
> Index: solr/src/java/org/apache/solr/spelling/suggest/Suggester.java
> ===================================================================
> --- solr/src/java/org/apache/solr/spelling/suggest/Suggester.java     
> (revision 1163940)
> +++ solr/src/java/org/apache/solr/spelling/suggest/Suggester.java     
> (working copy)
> @@ -81,8 +81,22 @@
>    public String init(NamedList config, SolrCore core) {
>      LOG.info("init: " + config);
>      String name = super.init(config, core);
> -    threshold = config.get(THRESHOLD_TOKEN_FREQUENCY) == null ? 0.0f
> -            : (Float)config.get(THRESHOLD_TOKEN_FREQUENCY);
> +    Object tokenFrequency = config.get(THRESHOLD_TOKEN_FREQUENCY);  
> +    if ( config.get(THRESHOLD_TOKEN_FREQUENCY) == null)
> +    {
> +     threshold = 0.0f;
> +    }
> +    else
> +    {
> +     if (tokenFrequency instanceof Number)
> +     {
> +             threshold = (Float)tokenFrequency;
> +     }
> +     else if(tokenFrequency instanceof String)
> +     {
> +             threshold = Float.valueOf((String)tokenFrequency);
> +     }
> +    }
>      sourceLocation = (String) config.get(LOCATION);
>      field = (String)config.get(FIELD);
>      lookupImpl = (String)config.get(LOOKUP_IMPL);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to