lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saurabh Kumar Singh (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SOLR-2737) I get ClassCastException when staring tomcat server (Solr configured with Suggester option enabled)
Date Thu, 01 Sep 2011 11:00:10 GMT
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 is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message