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 "Radha C." <cr...@ceiindia.com> on 2009/04/01 08:31:48 UTC

Runtime exception when adding documents using solrj

Hi All,
 
I am trying to index documents by using solrj client. I have written a
simple code below,
 
{            
            CommonsHttpSolrServer server =   new
CommonsHttpSolrServer("http://localhost:8080/solr/update");
            SolrInputDocument doc1=new SolrInputDocument();
            doc1.addField( "id", "id1", 1.0f );
            doc1.addField( "name", "doc1", 1.0f );
            doc1.addField( "price", 10 );        
            SolrInputDocument doc2 = new SolrInputDocument();
            doc2.addField( "id", "id2", 1.0f );
            doc2.addField( "name", "doc2", 1.0f );
            doc2.addField( "price", 20 );
            Collection<SolrInputDocument> docs = new
ArrayList<SolrInputDocument>();
            docs.add( doc1 );
            docs.add( doc2 );        
            server.add(docs);
            server.commit();
}
 
But I am getting the below error, Can anyone tell me what is the wrong with
the above code.
 
Exception in thread "main" java.lang.RuntimeException: Invalid version or
the data in not in 'javabin' format
        at
org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:98)
        at
org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(Binar
yResponseParser.java:39)
        at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
olrServer.java:470)
        at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
olrServer.java:245)
        at
org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.jav
a:243)
        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
        at SolrIndexTest.main(SolrIndexTest.java:46)
Java Result: 1


Re: Runtime exception when adding documents using solrj

Posted by vivek sar <vi...@gmail.com>.
Hello Shalin,

  Looks like I was using old version of solrconfig.xml (from Solr
1.2). After I updated to the latest solrconfig.xml (from 1.4) it seems
to be working fine.

Another question I got is how would I search on multi-cores,

 1) If I want to search for a word in two different cores?
 2) If I want to search for a word in all the cores.
 3) How would I search on multiple cores on multiple machines?

Single core I'm able to search like,

http://localhost:8080/solr/20090402/select?q=*:*

Thanks,
-vivek

------------------
Just in case if this might be helpful to others who might be trying to
use Solr multicore.

  Here is what I tried.

1)  Created this directory structure -

       multicore/core0 (put in the conf directory - with schema.xml
and solrconfig.xml - under core0)
       multicore/core1

     Make multicore as the solr.home and put the solr.xml under there

2) Added couple of cores in the solr.xml,

 <solr persistent="true">
    <cores adminPath="/admin/cores">
      <core name="core0" instanceDir="core0" dataDir="data"/>
      <core name="core1" instanceDir="core0" dataDir="../core1/data"/>
    </cores>
</solr>

Here core1 is using instancedir of core0 (using same schema.xml and
solrconfig.xml).

2) Started Solr

3) Data/index directory is created under both cores

4)  Tried following URLs,

    a) http://localhost:8080/solr/admin/cores
     - admin interface for both cores
    b) http://localhost:8080/solr/core0/admin/
     - I see the single core admin page
    c) http://localhost:8080/solr/admin/cores?action=STATUS
        - same as a
    d) http://localhost:8080/solr/admin/cores?action=STATUS&core=core0
       - same as b
    e) http://localhost:8080/solr/core0/select?q=*:*
       - shows result xml

5) I then created the core dynamically using CREATE service (this
requires Solr 1.4),

   http://localhost:8080/solr/admin/cores?action=CREATE&name=20090402&instanceDir=/Users/opal/temp/chat/solr/multicore/core0&dataDir=/Users/opal/temp/chat/solr/multicore/20090402/data

  - this dynamically updated the solr.xml and created a directory
structure (20090402/data) on the file system.

6) The use solrj to add beans to the recently created core







On Wed, Apr 1, 2009 at 8:26 PM, Shalin Shekhar Mangar
<sh...@gmail.com> wrote:
> On Thu, Apr 2, 2009 at 2:34 AM, vivek sar <vi...@gmail.com> wrote:
>> Thanks Shalin.
>>
>> I added that in the solrconfig.xml, but now I get this exception,
>>
>> org.apache.solr.common.SolrException: Not Found
>> Not Found
>> request: http://localhost:8080/solr/core0/update?wt=javabin&version=2.2
>>
>> I do have the "core0" under the solr.home. The core0 directory also
>> contains the conf and data directories. The solr.xml has following in
>> it,
>>
>> <cores adminPath="/admin/cores">
>>      <core name="core0" instanceDir="core0" dataDir="data"/>
>>  </cores>
>>
>>
>
> Are you able to see the Solr admin dashboard at
> http://localhost:8080/solr/core0/admin/ ? Are there any exceptions in
> Solr log?
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: Runtime exception when adding documents using solrj

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Thu, Apr 2, 2009 at 2:34 AM, vivek sar <vi...@gmail.com> wrote:
> Thanks Shalin.
>
> I added that in the solrconfig.xml, but now I get this exception,
>
> org.apache.solr.common.SolrException: Not Found
> Not Found
> request: http://localhost:8080/solr/core0/update?wt=javabin&version=2.2
>
> I do have the "core0" under the solr.home. The core0 directory also
> contains the conf and data directories. The solr.xml has following in
> it,
>
> <cores adminPath="/admin/cores">
>      <core name="core0" instanceDir="core0" dataDir="data"/>
>  </cores>
>
>

Are you able to see the Solr admin dashboard at
http://localhost:8080/solr/core0/admin/ ? Are there any exceptions in
Solr log?

-- 
Regards,
Shalin Shekhar Mangar.

Re: Runtime exception when adding documents using solrj

Posted by vivek sar <vi...@gmail.com>.
Thanks Shalin.

I added that in the solrconfig.xml, but now I get this exception,

org.apache.solr.common.SolrException: Not Found
Not Found
request: http://localhost:8080/solr/core0/update?wt=javabin&version=2.2

I do have the "core0" under the solr.home. The core0 directory also
contains the conf and data directories. The solr.xml has following in
it,

<cores adminPath="/admin/cores">
      <core name="core0" instanceDir="core0" dataDir="data"/>
 </cores>

 Am I missing anything else?

Thanks,
-vivek

On Wed, Apr 1, 2009 at 1:02 PM, Shalin Shekhar Mangar
<sh...@gmail.com> wrote:
> On Thu, Apr 2, 2009 at 1:13 AM, vivek sar <vi...@gmail.com> wrote:
>> Hi,
>>
>>  I'm trying to add the list of POJO objects (using annotations) using
>> solrj, but the "server.addBeans(...) " is throwing this exception,
>>
>> org.apache.solr.common.SolrException: Bad Request
>> Bad Request
>> request: http://localhost:8080/solr/core0/update?wt=javabin&version=2.2
>>
>> Note, I'm using multi-core. There is no other exception in the solr log.
>>
>
> Can you make sure all the cores' solrconfig.xml have the following line?
>
> <requestHandler name="/update/javabin"
> class="solr.BinaryUpdateRequestHandler" />
>
> The above is needed for binary update format to work. I don't think
> the multi core example solrconfig.xml in solr nightly builds contain
> this line.
>
>> Related question - I'm trying to upgrade the solrj from nightly build,
>> but I get some classnotfound exception
>> (java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory). What are
>> all the dependencies for Solrj1.4 (wiki has only up to 1.3
>> information).
>>
>
> I think you need slf4j-api-1.5.5.jar and slf4j-jdk14-1.5.5.jar. Both
> can be found in solr's nightly downloads in the lib directory.
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: Runtime exception when adding documents using solrj

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Thu, Apr 2, 2009 at 1:13 AM, vivek sar <vi...@gmail.com> wrote:
> Hi,
>
>  I'm trying to add the list of POJO objects (using annotations) using
> solrj, but the "server.addBeans(...) " is throwing this exception,
>
> org.apache.solr.common.SolrException: Bad Request
> Bad Request
> request: http://localhost:8080/solr/core0/update?wt=javabin&version=2.2
>
> Note, I'm using multi-core. There is no other exception in the solr log.
>

Can you make sure all the cores' solrconfig.xml have the following line?

<requestHandler name="/update/javabin"
class="solr.BinaryUpdateRequestHandler" />

The above is needed for binary update format to work. I don't think
the multi core example solrconfig.xml in solr nightly builds contain
this line.

> Related question - I'm trying to upgrade the solrj from nightly build,
> but I get some classnotfound exception
> (java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory). What are
> all the dependencies for Solrj1.4 (wiki has only up to 1.3
> information).
>

I think you need slf4j-api-1.5.5.jar and slf4j-jdk14-1.5.5.jar. Both
can be found in solr's nightly downloads in the lib directory.

-- 
Regards,
Shalin Shekhar Mangar.

Re: Runtime exception when adding documents using solrj

Posted by vivek sar <vi...@gmail.com>.
Hi,

  I'm trying to add the list of POJO objects (using annotations) using
solrj, but the "server.addBeans(...) " is throwing this exception,

org.apache.solr.common.SolrException: Bad Request
Bad Request
request: http://localhost:8080/solr/core0/update?wt=javabin&version=2.2

Note, I'm using multi-core. There is no other exception in the solr log.

Related question - I'm trying to upgrade the solrj from nightly build,
but I get some classnotfound exception
(java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory). What are
all the dependencies for Solrj1.4 (wiki has only up to 1.3
information).

Thanks,
-vivek



On Wed, Apr 1, 2009 at 3:30 AM, Radha C. <cr...@ceiindia.com> wrote:
>
> Thanks Paul, I resolved it, I missed one field declaration in schema.xml. Now I added, and it works.
>
> -----Original Message-----
> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
> Sent: Wednesday, April 01, 2009 3:52 PM
> To: solr-user@lucene.apache.org; cradha@ceiindia.com
> Subject: Re: Runtime exception when adding documents using solrj
>
> Can u take a look at the Solr logs and see what is hapening?
>
> On Wed, Apr 1, 2009 at 3:19 PM, Radha C. <cr...@ceiindia.com> wrote:
>>
>> Thanks Paul,
>>
>> I changed the URL but I am getting another error - Bad request , Any help will be appriciated.
>>
>> Exception in thread "main" org.apache.solr.common.SolrException: Bad
>> Request Bad Request
>> request: http://localhost:8080/solr/update?wt=javabin
>>        at
>> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
>> sHttpSolrServer.java:428)
>>        at
>> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
>> sHttpSolrServer.java:245)
>>        at
>> org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateReque
>> st.java:243)
>>        at
>> org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>>        at SolrIndexTest.main(SolrIndexTest.java:47)
>> Java Result: 1
>>
>>
>>
>>
>> -----Original Message-----
>> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
>> Sent: Wednesday, April 01, 2009 2:26 PM
>> To: solr-user@lucene.apache.org; cradha@ceiindia.com
>> Subject: Re: Runtime exception when adding documents using solrj
>>
>> the url is wrong
>> try this
>> CommonsHttpSolrServer server =   new
>> CommonsHttpSolrServer("http://localhost:8080/solr/");
>>
>> On Wed, Apr 1, 2009 at 2:04 PM, Radha C. <cr...@ceiindia.com> wrote:
>>>
>>> Can anyone please tell me , what is the issue with the below java code..
>>>
>>> -----Original Message-----
>>> From: Radha C. [mailto:cradha@ceiindia.com]
>>> Sent: Wednesday, April 01, 2009 12:28 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: RE: Runtime exception when adding documents using solrj
>>>
>>>
>>> I am using Solr 1.3 version
>>>
>>>  _____
>>>
>>> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
>>> Sent: Wednesday, April 01, 2009 12:16 PM
>>> To: solr-user@lucene.apache.org; cradha@ceiindia.com
>>> Subject: Re: Runtime exception when adding documents using solrj
>>>
>>>
>>> which version of Solr are you using?
>>>
>>>
>>> On Wed, Apr 1, 2009 at 12:01 PM, Radha C. <cr...@ceiindia.com> wrote:
>>>
>>>
>>> Hi All,
>>>
>>> I am trying to index documents by using solrj client. I have written
>>> a simple code below,
>>>
>>> {
>>>           CommonsHttpSolrServer server =   new
>>> CommonsHttpSolrServer("http://localhost:8080/solr/update");
>>>           SolrInputDocument doc1=new SolrInputDocument();
>>>           doc1.addField( "id", "id1", 1.0f );
>>>           doc1.addField( "name", "doc1", 1.0f );
>>>           doc1.addField( "price", 10 );
>>>           SolrInputDocument doc2 = new SolrInputDocument();
>>>           doc2.addField( "id", "id2", 1.0f );
>>>           doc2.addField( "name", "doc2", 1.0f );
>>>           doc2.addField( "price", 20 );
>>>           Collection<SolrInputDocument> docs = new
>>> ArrayList<SolrInputDocument>();
>>>           docs.add( doc1 );
>>>           docs.add( doc2 );
>>>           server.add(docs);
>>>           server.commit();
>>> }
>>>
>>> But I am getting the below error, Can anyone tell me what is the
>>> wrong with the above code.
>>>
>>> Exception in thread "main" java.lang.RuntimeException: Invalid
>>> version or the data in not in 'javabin' format
>>>       at
>>> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:
>>> 9
>>> 8)
>>>       at
>>> org.apache.solr.client.solrj.impl.BinaryResponseParser.processRespons
>>> e
>>> (Binar
>>> yResponseParser.java:39)
>>>       at
>>> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Commo
>>> n
>>> sHttpS
>>> olrServer.java:470)
>>>       at
>>> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Commo
>>> n
>>> sHttpS
>>> olrServer.java:245)
>>>       at
>>> org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequ
>>> e
>>> st.jav
>>> a:243)
>>>       at
>>> org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>>>       at SolrIndexTest.main(SolrIndexTest.java:46)
>>> Java Result: 1
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> --Noble Paul
>>>
>>>
>>
>>
>>
>> --
>> --Noble Paul
>>
>>
>
>
>
> --
> --Noble Paul
>
>

RE: Runtime exception when adding documents using solrj

Posted by "Radha C." <cr...@ceiindia.com>.
Thanks Paul, I resolved it, I missed one field declaration in schema.xml. Now I added, and it works.

-----Original Message-----
From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com] 
Sent: Wednesday, April 01, 2009 3:52 PM
To: solr-user@lucene.apache.org; cradha@ceiindia.com
Subject: Re: Runtime exception when adding documents using solrj

Can u take a look at the Solr logs and see what is hapening?

On Wed, Apr 1, 2009 at 3:19 PM, Radha C. <cr...@ceiindia.com> wrote:
>
> Thanks Paul,
>
> I changed the URL but I am getting another error - Bad request , Any help will be appriciated.
>
> Exception in thread "main" org.apache.solr.common.SolrException: Bad 
> Request Bad Request
> request: http://localhost:8080/solr/update?wt=javabin
>        at 
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
> sHttpSolrServer.java:428)
>        at 
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
> sHttpSolrServer.java:245)
>        at 
> org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateReque
> st.java:243)
>        at 
> org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>        at SolrIndexTest.main(SolrIndexTest.java:47)
> Java Result: 1
>
>
>
>
> -----Original Message-----
> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
> Sent: Wednesday, April 01, 2009 2:26 PM
> To: solr-user@lucene.apache.org; cradha@ceiindia.com
> Subject: Re: Runtime exception when adding documents using solrj
>
> the url is wrong
> try this
> CommonsHttpSolrServer server =   new
> CommonsHttpSolrServer("http://localhost:8080/solr/");
>
> On Wed, Apr 1, 2009 at 2:04 PM, Radha C. <cr...@ceiindia.com> wrote:
>>
>> Can anyone please tell me , what is the issue with the below java code..
>>
>> -----Original Message-----
>> From: Radha C. [mailto:cradha@ceiindia.com]
>> Sent: Wednesday, April 01, 2009 12:28 PM
>> To: solr-user@lucene.apache.org
>> Subject: RE: Runtime exception when adding documents using solrj
>>
>>
>> I am using Solr 1.3 version
>>
>>  _____
>>
>> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
>> Sent: Wednesday, April 01, 2009 12:16 PM
>> To: solr-user@lucene.apache.org; cradha@ceiindia.com
>> Subject: Re: Runtime exception when adding documents using solrj
>>
>>
>> which version of Solr are you using?
>>
>>
>> On Wed, Apr 1, 2009 at 12:01 PM, Radha C. <cr...@ceiindia.com> wrote:
>>
>>
>> Hi All,
>>
>> I am trying to index documents by using solrj client. I have written 
>> a simple code below,
>>
>> {
>>           CommonsHttpSolrServer server =   new 
>> CommonsHttpSolrServer("http://localhost:8080/solr/update");
>>           SolrInputDocument doc1=new SolrInputDocument();
>>           doc1.addField( "id", "id1", 1.0f );
>>           doc1.addField( "name", "doc1", 1.0f );
>>           doc1.addField( "price", 10 );
>>           SolrInputDocument doc2 = new SolrInputDocument();
>>           doc2.addField( "id", "id2", 1.0f );
>>           doc2.addField( "name", "doc2", 1.0f );
>>           doc2.addField( "price", 20 );
>>           Collection<SolrInputDocument> docs = new 
>> ArrayList<SolrInputDocument>();
>>           docs.add( doc1 );
>>           docs.add( doc2 );
>>           server.add(docs);
>>           server.commit();
>> }
>>
>> But I am getting the below error, Can anyone tell me what is the 
>> wrong with the above code.
>>
>> Exception in thread "main" java.lang.RuntimeException: Invalid 
>> version or the data in not in 'javabin' format
>>       at
>> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:
>> 9
>> 8)
>>       at
>> org.apache.solr.client.solrj.impl.BinaryResponseParser.processRespons
>> e
>> (Binar
>> yResponseParser.java:39)
>>       at
>> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Commo
>> n
>> sHttpS
>> olrServer.java:470)
>>       at
>> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Commo
>> n
>> sHttpS
>> olrServer.java:245)
>>       at
>> org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequ
>> e
>> st.jav
>> a:243)
>>       at
>> org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>>       at SolrIndexTest.main(SolrIndexTest.java:46)
>> Java Result: 1
>>
>>
>>
>>
>>
>>
>> --
>> --Noble Paul
>>
>>
>
>
>
> --
> --Noble Paul
>
>



--
--Noble Paul


Re: Runtime exception when adding documents using solrj

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
Can u take a look at the Solr logs and see what is hapening?

On Wed, Apr 1, 2009 at 3:19 PM, Radha C. <cr...@ceiindia.com> wrote:
>
> Thanks Paul,
>
> I changed the URL but I am getting another error - Bad request , Any help will be appriciated.
>
> Exception in thread "main" org.apache.solr.common.SolrException: Bad Request
> Bad Request
> request: http://localhost:8080/solr/update?wt=javabin
>        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:428)
>        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:245)
>        at org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.java:243)
>        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>        at SolrIndexTest.main(SolrIndexTest.java:47)
> Java Result: 1
>
>
>
>
> -----Original Message-----
> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
> Sent: Wednesday, April 01, 2009 2:26 PM
> To: solr-user@lucene.apache.org; cradha@ceiindia.com
> Subject: Re: Runtime exception when adding documents using solrj
>
> the url is wrong
> try this
> CommonsHttpSolrServer server =   new
> CommonsHttpSolrServer("http://localhost:8080/solr/");
>
> On Wed, Apr 1, 2009 at 2:04 PM, Radha C. <cr...@ceiindia.com> wrote:
>>
>> Can anyone please tell me , what is the issue with the below java code..
>>
>> -----Original Message-----
>> From: Radha C. [mailto:cradha@ceiindia.com]
>> Sent: Wednesday, April 01, 2009 12:28 PM
>> To: solr-user@lucene.apache.org
>> Subject: RE: Runtime exception when adding documents using solrj
>>
>>
>> I am using Solr 1.3 version
>>
>>  _____
>>
>> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
>> Sent: Wednesday, April 01, 2009 12:16 PM
>> To: solr-user@lucene.apache.org; cradha@ceiindia.com
>> Subject: Re: Runtime exception when adding documents using solrj
>>
>>
>> which version of Solr are you using?
>>
>>
>> On Wed, Apr 1, 2009 at 12:01 PM, Radha C. <cr...@ceiindia.com> wrote:
>>
>>
>> Hi All,
>>
>> I am trying to index documents by using solrj client. I have written a
>> simple code below,
>>
>> {
>>           CommonsHttpSolrServer server =   new
>> CommonsHttpSolrServer("http://localhost:8080/solr/update");
>>           SolrInputDocument doc1=new SolrInputDocument();
>>           doc1.addField( "id", "id1", 1.0f );
>>           doc1.addField( "name", "doc1", 1.0f );
>>           doc1.addField( "price", 10 );
>>           SolrInputDocument doc2 = new SolrInputDocument();
>>           doc2.addField( "id", "id2", 1.0f );
>>           doc2.addField( "name", "doc2", 1.0f );
>>           doc2.addField( "price", 20 );
>>           Collection<SolrInputDocument> docs = new
>> ArrayList<SolrInputDocument>();
>>           docs.add( doc1 );
>>           docs.add( doc2 );
>>           server.add(docs);
>>           server.commit();
>> }
>>
>> But I am getting the below error, Can anyone tell me what is the wrong
>> with the above code.
>>
>> Exception in thread "main" java.lang.RuntimeException: Invalid version
>> or the data in not in 'javabin' format
>>       at
>> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:9
>> 8)
>>       at
>> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse
>> (Binar
>> yResponseParser.java:39)
>>       at
>> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
>> sHttpS
>> olrServer.java:470)
>>       at
>> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
>> sHttpS
>> olrServer.java:245)
>>       at
>> org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateReque
>> st.jav
>> a:243)
>>       at
>> org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>>       at SolrIndexTest.main(SolrIndexTest.java:46)
>> Java Result: 1
>>
>>
>>
>>
>>
>>
>> --
>> --Noble Paul
>>
>>
>
>
>
> --
> --Noble Paul
>
>



-- 
--Noble Paul

RE: Runtime exception when adding documents using solrj

Posted by "Radha C." <cr...@ceiindia.com>.
Thanks Paul,

I changed the URL but I am getting another error - Bad request , Any help will be appriciated.

Exception in thread "main" org.apache.solr.common.SolrException: Bad Request
Bad Request
request: http://localhost:8080/solr/update?wt=javabin
        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:428)
        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:245)
        at org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.java:243)
        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
        at SolrIndexTest.main(SolrIndexTest.java:47)
Java Result: 1 




-----Original Message-----
From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com] 
Sent: Wednesday, April 01, 2009 2:26 PM
To: solr-user@lucene.apache.org; cradha@ceiindia.com
Subject: Re: Runtime exception when adding documents using solrj

the url is wrong
try this
CommonsHttpSolrServer server =   new
CommonsHttpSolrServer("http://localhost:8080/solr/");

On Wed, Apr 1, 2009 at 2:04 PM, Radha C. <cr...@ceiindia.com> wrote:
>
> Can anyone please tell me , what is the issue with the below java code..
>
> -----Original Message-----
> From: Radha C. [mailto:cradha@ceiindia.com]
> Sent: Wednesday, April 01, 2009 12:28 PM
> To: solr-user@lucene.apache.org
> Subject: RE: Runtime exception when adding documents using solrj
>
>
> I am using Solr 1.3 version
>
>  _____
>
> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
> Sent: Wednesday, April 01, 2009 12:16 PM
> To: solr-user@lucene.apache.org; cradha@ceiindia.com
> Subject: Re: Runtime exception when adding documents using solrj
>
>
> which version of Solr are you using?
>
>
> On Wed, Apr 1, 2009 at 12:01 PM, Radha C. <cr...@ceiindia.com> wrote:
>
>
> Hi All,
>
> I am trying to index documents by using solrj client. I have written a 
> simple code below,
>
> {
>           CommonsHttpSolrServer server =   new 
> CommonsHttpSolrServer("http://localhost:8080/solr/update");
>           SolrInputDocument doc1=new SolrInputDocument();
>           doc1.addField( "id", "id1", 1.0f );
>           doc1.addField( "name", "doc1", 1.0f );
>           doc1.addField( "price", 10 );
>           SolrInputDocument doc2 = new SolrInputDocument();
>           doc2.addField( "id", "id2", 1.0f );
>           doc2.addField( "name", "doc2", 1.0f );
>           doc2.addField( "price", 20 );
>           Collection<SolrInputDocument> docs = new 
> ArrayList<SolrInputDocument>();
>           docs.add( doc1 );
>           docs.add( doc2 );
>           server.add(docs);
>           server.commit();
> }
>
> But I am getting the below error, Can anyone tell me what is the wrong 
> with the above code.
>
> Exception in thread "main" java.lang.RuntimeException: Invalid version 
> or the data in not in 'javabin' format
>       at
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:9
> 8)
>       at
> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse
> (Binar
> yResponseParser.java:39)
>       at
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
> sHttpS
> olrServer.java:470)
>       at
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
> sHttpS
> olrServer.java:245)
>       at
> org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateReque
> st.jav
> a:243)
>       at 
> org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>       at SolrIndexTest.main(SolrIndexTest.java:46)
> Java Result: 1
>
>
>
>
>
>
> --
> --Noble Paul
>
>



--
--Noble Paul


Re: Runtime exception when adding documents using solrj

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
the url is wrong
try this
CommonsHttpSolrServer server =   new
CommonsHttpSolrServer("http://localhost:8080/solr/");

On Wed, Apr 1, 2009 at 2:04 PM, Radha C. <cr...@ceiindia.com> wrote:
>
> Can anyone please tell me , what is the issue with the below java code..
>
> -----Original Message-----
> From: Radha C. [mailto:cradha@ceiindia.com]
> Sent: Wednesday, April 01, 2009 12:28 PM
> To: solr-user@lucene.apache.org
> Subject: RE: Runtime exception when adding documents using solrj
>
>
> I am using Solr 1.3 version
>
>  _____
>
> From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
> Sent: Wednesday, April 01, 2009 12:16 PM
> To: solr-user@lucene.apache.org; cradha@ceiindia.com
> Subject: Re: Runtime exception when adding documents using solrj
>
>
> which version of Solr are you using?
>
>
> On Wed, Apr 1, 2009 at 12:01 PM, Radha C. <cr...@ceiindia.com> wrote:
>
>
> Hi All,
>
> I am trying to index documents by using solrj client. I have written a
> simple code below,
>
> {
>           CommonsHttpSolrServer server =   new
> CommonsHttpSolrServer("http://localhost:8080/solr/update");
>           SolrInputDocument doc1=new SolrInputDocument();
>           doc1.addField( "id", "id1", 1.0f );
>           doc1.addField( "name", "doc1", 1.0f );
>           doc1.addField( "price", 10 );
>           SolrInputDocument doc2 = new SolrInputDocument();
>           doc2.addField( "id", "id2", 1.0f );
>           doc2.addField( "name", "doc2", 1.0f );
>           doc2.addField( "price", 20 );
>           Collection<SolrInputDocument> docs = new
> ArrayList<SolrInputDocument>();
>           docs.add( doc1 );
>           docs.add( doc2 );
>           server.add(docs);
>           server.commit();
> }
>
> But I am getting the below error, Can anyone tell me what is the wrong with
> the above code.
>
> Exception in thread "main" java.lang.RuntimeException: Invalid version or
> the data in not in 'javabin' format
>       at
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:98)
>       at
> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(Binar
> yResponseParser.java:39)
>       at
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
> olrServer.java:470)
>       at
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
> olrServer.java:245)
>       at
> org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.jav
> a:243)
>       at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>       at SolrIndexTest.main(SolrIndexTest.java:46)
> Java Result: 1
>
>
>
>
>
>
> --
> --Noble Paul
>
>



--
--Noble Paul

RE: Runtime exception when adding documents using solrj

Posted by "Radha C." <cr...@ceiindia.com>.
Can anyone please tell me , what is the issue with the below java code.. 

-----Original Message-----
From: Radha C. [mailto:cradha@ceiindia.com] 
Sent: Wednesday, April 01, 2009 12:28 PM
To: solr-user@lucene.apache.org
Subject: RE: Runtime exception when adding documents using solrj

 
I am using Solr 1.3 version

  _____  

From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com]
Sent: Wednesday, April 01, 2009 12:16 PM
To: solr-user@lucene.apache.org; cradha@ceiindia.com
Subject: Re: Runtime exception when adding documents using solrj


which version of Solr are you using? 


On Wed, Apr 1, 2009 at 12:01 PM, Radha C. <cr...@ceiindia.com> wrote:


Hi All,

I am trying to index documents by using solrj client. I have written a
simple code below,

{
           CommonsHttpSolrServer server =   new
CommonsHttpSolrServer("http://localhost:8080/solr/update");
           SolrInputDocument doc1=new SolrInputDocument();
           doc1.addField( "id", "id1", 1.0f );
           doc1.addField( "name", "doc1", 1.0f );
           doc1.addField( "price", 10 );
           SolrInputDocument doc2 = new SolrInputDocument();
           doc2.addField( "id", "id2", 1.0f );
           doc2.addField( "name", "doc2", 1.0f );
           doc2.addField( "price", 20 );
           Collection<SolrInputDocument> docs = new
ArrayList<SolrInputDocument>();
           docs.add( doc1 );
           docs.add( doc2 );
           server.add(docs);
           server.commit();
}

But I am getting the below error, Can anyone tell me what is the wrong with
the above code.

Exception in thread "main" java.lang.RuntimeException: Invalid version or
the data in not in 'javabin' format
       at
org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:98)
       at
org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(Binar
yResponseParser.java:39)
       at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
olrServer.java:470)
       at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
olrServer.java:245)
       at
org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.jav
a:243)
       at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
       at SolrIndexTest.main(SolrIndexTest.java:46)
Java Result: 1






-- 
--Noble Paul



RE: Runtime exception when adding documents using solrj

Posted by "Radha C." <cr...@ceiindia.com>.
 
I am using Solr 1.3 version

  _____  

From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.paul@gmail.com] 
Sent: Wednesday, April 01, 2009 12:16 PM
To: solr-user@lucene.apache.org; cradha@ceiindia.com
Subject: Re: Runtime exception when adding documents using solrj


which version of Solr are you using? 


On Wed, Apr 1, 2009 at 12:01 PM, Radha C. <cr...@ceiindia.com> wrote:


Hi All,

I am trying to index documents by using solrj client. I have written a
simple code below,

{
           CommonsHttpSolrServer server =   new
CommonsHttpSolrServer("http://localhost:8080/solr/update");
           SolrInputDocument doc1=new SolrInputDocument();
           doc1.addField( "id", "id1", 1.0f );
           doc1.addField( "name", "doc1", 1.0f );
           doc1.addField( "price", 10 );
           SolrInputDocument doc2 = new SolrInputDocument();
           doc2.addField( "id", "id2", 1.0f );
           doc2.addField( "name", "doc2", 1.0f );
           doc2.addField( "price", 20 );
           Collection<SolrInputDocument> docs = new
ArrayList<SolrInputDocument>();
           docs.add( doc1 );
           docs.add( doc2 );
           server.add(docs);
           server.commit();
}

But I am getting the below error, Can anyone tell me what is the wrong with
the above code.

Exception in thread "main" java.lang.RuntimeException: Invalid version or
the data in not in 'javabin' format
       at
org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:98)
       at
org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(Binar
yResponseParser.java:39)
       at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
olrServer.java:470)
       at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
olrServer.java:245)
       at
org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.jav
a:243)
       at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
       at SolrIndexTest.main(SolrIndexTest.java:46)
Java Result: 1






-- 
--Noble Paul


Re: Runtime exception when adding documents using solrj

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
which version of Solr are you using?

On Wed, Apr 1, 2009 at 12:01 PM, Radha C. <cr...@ceiindia.com> wrote:

> Hi All,
>
> I am trying to index documents by using solrj client. I have written a
> simple code below,
>
> {
>            CommonsHttpSolrServer server =   new
> CommonsHttpSolrServer("http://localhost:8080/solr/update");
>            SolrInputDocument doc1=new SolrInputDocument();
>            doc1.addField( "id", "id1", 1.0f );
>            doc1.addField( "name", "doc1", 1.0f );
>            doc1.addField( "price", 10 );
>            SolrInputDocument doc2 = new SolrInputDocument();
>            doc2.addField( "id", "id2", 1.0f );
>            doc2.addField( "name", "doc2", 1.0f );
>            doc2.addField( "price", 20 );
>            Collection<SolrInputDocument> docs = new
> ArrayList<SolrInputDocument>();
>            docs.add( doc1 );
>            docs.add( doc2 );
>            server.add(docs);
>            server.commit();
> }
>
> But I am getting the below error, Can anyone tell me what is the wrong with
> the above code.
>
> Exception in thread "main" java.lang.RuntimeException: Invalid version or
> the data in not in 'javabin' format
>        at
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:98)
>        at
>
> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(Binar
> yResponseParser.java:39)
>        at
>
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
> olrServer.java:470)
>        at
>
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
> olrServer.java:245)
>        at
>
> org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.jav
> a:243)
>        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
>        at SolrIndexTest.main(SolrIndexTest.java:46)
> Java Result: 1
>
>


-- 
--Noble Paul