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 vivek sar <vi...@gmail.com> on 2009/04/02 00:51:42 UTC

java.lang.ClassCastException: java.lang.Long using Solrj

Hi,

  I'm using solrj (released v 1.3) to add my POJO objects
(server.addbeans(...)), but I'm getting this exception,

java.lang.ClassCastException: java.lang.Long
        at org.apache.solr.common.util.NamedListCodec.unmarshal(NamedListCodec.java:89)
        at org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39)
        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:385)
        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183)
        at org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.java:217)
        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
        at org.apache.solr.client.solrj.SolrServer.addBeans(SolrServer.java:57)

I don't have any "Long" member variable in my java object - so not
sure where is this coming from. I've checked the schema.xml to make
sure the data types are ok. I'm adding 15K objects at a time - I'm
assuming that should be ok.

Any ideas?

Thanks,
-vivek

Re: java.lang.ClassCastException: java.lang.Long using Solrj

Posted by vivek sar <vi...@gmail.com>.
Thanks Noble. That helped - turned out there was field name mismatch in my bean.

2009/4/1 Noble Paul നോബിള്‍  नोब्ळ् <no...@gmail.com>:
> The classcast exception is misleading. It happens because the response
> itself was some error response.
>
> debug it by setting the XmlResponseParser
> http://wiki.apache.org/solr/Solrj#head-12c26b2d7806432c88b26cf66e236e9bd6e91849
>
> On Thu, Apr 2, 2009 at 4:21 AM, vivek sar <vi...@gmail.com> wrote:
>> Hi,
>>
>>  I'm using solrj (released v 1.3) to add my POJO objects
>> (server.addbeans(...)), but I'm getting this exception,
>>
>> java.lang.ClassCastException: java.lang.Long
>>        at org.apache.solr.common.util.NamedListCodec.unmarshal(NamedListCodec.java:89)
>>        at org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39)
>>        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:385)
>>        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183)
>>        at org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.java:217)
>>        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>>        at org.apache.solr.client.solrj.SolrServer.addBeans(SolrServer.java:57)
>>
>> I don't have any "Long" member variable in my java object - so not
>> sure where is this coming from. I've checked the schema.xml to make
>> sure the data types are ok. I'm adding 15K objects at a time - I'm
>> assuming that should be ok.
>>
>> Any ideas?
>>
>> Thanks,
>> -vivek
>>
>
>
>
> --
> --Noble Paul
>

Re: java.lang.ClassCastException: java.lang.Long using Solrj

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
The classcast exception is misleading. It happens because the response
itself was some error response.

debug it by setting the XmlResponseParser
http://wiki.apache.org/solr/Solrj#head-12c26b2d7806432c88b26cf66e236e9bd6e91849

On Thu, Apr 2, 2009 at 4:21 AM, vivek sar <vi...@gmail.com> wrote:
> Hi,
>
>  I'm using solrj (released v 1.3) to add my POJO objects
> (server.addbeans(...)), but I'm getting this exception,
>
> java.lang.ClassCastException: java.lang.Long
>        at org.apache.solr.common.util.NamedListCodec.unmarshal(NamedListCodec.java:89)
>        at org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39)
>        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:385)
>        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183)
>        at org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.java:217)
>        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>        at org.apache.solr.client.solrj.SolrServer.addBeans(SolrServer.java:57)
>
> I don't have any "Long" member variable in my java object - so not
> sure where is this coming from. I've checked the schema.xml to make
> sure the data types are ok. I'm adding 15K objects at a time - I'm
> assuming that should be ok.
>
> Any ideas?
>
> Thanks,
> -vivek
>



-- 
--Noble Paul