You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Tejas Bavishi <te...@bsil.com> on 2011/08/01 08:22:53 UTC

RE: Query regarding Solr ClassCastException on client side for Java

Hi

This happened because the there are 2 jars - apache-solr-solrj-3.3.0.jar and apache-solr-solrj-1.3.0.jar in the Apache Solr distribution. After I removed the apache-solr-solrj-1.3.0.jar file, the code is working fine.

Thank you for your pointers!!

Best Regards,
Tejas Bavishi

-----Original Message-----
From: Chris Hostetter [mailto:hossman_lucene@fucit.org] 
Sent: Monday, August 01, 2011 3:21 AM
To: solr-user@lucene.apache.org
Subject: Re: Query regarding Solr ClassCastException on client side for Java


: I am using apache solr 3.3 on windows 7 with JDK 1.6.

First question: what version of SolrJ are you using?  is it also 3.3?

: At the line, QueryResponse queryResponse = solrServer.query(query1); 
: Class Cast Exception is thrown and no data is fetched. I suspect this 
: has something to do with Solrj client distribution.
	...
: INFO: [] webapp=/solr path=/select params={facet=true&facet.mincount=1&q=*:*&fac
: et.field=grp_id&wt=javabin&rows=45&version=2.2} hits=25 status=0 QTime=2

Assuming that URL still causes the same problem, can you try loading it in 
a browser (using "wt=xml" instead of wt=javabin) and posting the results 
to the list?  It would help if you could also add "echoParams=all" to the 
URL and/or show us your requestHandler configuration.

I haven't dug into the code, but based on your stack trace i suspect maybe 
there is a bug somewhere in the NamedListCodec that assumes Map keys will 
always be Strings -- would like to see the data being returned to try and 
unerstand why tests are failing or no one else has reported seeing the 
same problem you are since that request seems fairly simple and straight 
forward (unless ou have some interesting defaults in your config)


: Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to jav
: a.lang.String
:         at org.apache.solr.common.util.NamedListCodec.readOrderedMap(NamedListCo
: dec.java:97)
:         at org.apache.solr.common.util.NamedListCodec.readVal(NamedListCodec.jav
: a:154)
:         at org.apache.solr.common.util.NamedListCodec.readSolrDocument(NamedList
: Codec.java:284)
:         at org.apache.solr.common.util.NamedListCodec.readVal(NamedListCodec.jav
: a:171)
:         at org.apache.solr.common.util.NamedListCodec.readArray(NamedListCodec.j
: ava:367)
:         at org.apache.solr.common.util.NamedListCodec.readVal(NamedListCodec.jav
: a:153)
:         at org.apache.solr.common.util.NamedListCodec.readSolrDocumentList(Named
: ListCodec.java:301)
:         at org.apache.solr.common.util.NamedListCodec.readVal(NamedListCodec.jav
: a:172)
:         at org.apache.solr.common.util.NamedListCodec.readOrderedMap(NamedListCo
: dec.java:98)
:         at org.apache.solr.common.util.NamedListCodec.readVal(NamedListCodec.jav
: a:154)
:         at org.apache.solr.common.util.NamedListCodec.unmarshal(NamedListCodec.j
: ava:89)
:         at org.apache.solr.client.solrj.impl.BinaryResponseParser.processRespons
: e(BinaryResponseParser.java:39)


-Hoss