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 Federico Valeri <fe...@gmail.com> on 2012/07/27 21:58:29 UTC

Solr 4.0-ALPHA and ModifiableSolrParams

Hi, I'm trying to get a JSON response with this Java code:

SolrServer solr = new HttpSolrServer("http://localhost:8080/solr");
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("qt", "/select");
params.set("q", "contenuto:(" + query + ")");
params.set("hl", "true");
params.set("hl.fl", "id,contenuto");
params.set("wt", "json");
QueryResponse response = solr.query(params);
log.debug(response.toString());

but from log i see "&wt=javabin" in query
and "..docs=[SolrDocument{id=452011.." in response ..

instead I would expect "&wt=json" and "..docs=[{id=452011.."

What I am missing?

Re: Request header is too large.

Posted by Xue-Feng Yang <ju...@yahoo.com>.
Thank you, Alexandre. I solved this problem. It's not a database problem but a server problem as the error message clearly stated. I resolved this by adding more tcp transport buffer size in application server.

Xuefeng  


________________________________
 From: Alexandre Rafalovitch <ar...@gmail.com>
To: Xue-Feng Yang <ju...@yahoo.com>; solr-user@lucene.apache.org 
Sent: Sunday, July 29, 2012 12:10:20 AM
Subject: Re: Request header is too large.
 
Where is the error message? On the database side?

If it is repeatable, I would just put the two on separate machines and
wireshark the http conversation. The problem might become apparent then
from visual inspection.

Regards,
    Alex
On Jul 28, 2012 1:24 PM, "Xue-Feng Yang" <ju...@yahoo.com> wrote:

> Hi all,
>
> When run DIH  indexing data from database, I run into the following error.
>
> Anyone knows what is the problem?
>
> Thanks,
>
> Xufeng
>
> ///////////////////////////////////////////////////
>
> SEVERE: GRIZZLY0040: Request header is too large.
> java.nio.BufferOverflowException
>     at
> com.sun.grizzly.tcp.http11.InternalInputBuffer.fill(InternalInputBuffer.java:765)
>     at
> com.sun.grizzly.tcp.http11.InternalInputBuffer.parseHeader(InternalInputBuffer.java:669)
>     at
> com.sun.grizzly.tcp.http11.InternalInputBuffer.parseHeaders(InternalInputBuffer.java:555)
>     at
> com.sun.grizzly.http.ProcessorTask.parseRequest(ProcessorTask.java:881)
>     at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:692)
>     at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
>     at
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>     at
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>     at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>     at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>     at
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>     at
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>     at
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>     at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>     at
> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>     at
> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>     at java.lang.Thread.run(Thread.java:662)

Re: Request header is too large.

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Where is the error message? On the database side?

If it is repeatable, I would just put the two on separate machines and
wireshark the http conversation. The problem might become apparent then
from visual inspection.

Regards,
    Alex
On Jul 28, 2012 1:24 PM, "Xue-Feng Yang" <ju...@yahoo.com> wrote:

> Hi all,
>
> When run DIH  indexing data from database, I run into the following error.
>
> Anyone knows what is the problem?
>
> Thanks,
>
> Xufeng
>
> ///////////////////////////////////////////////////
>
> SEVERE: GRIZZLY0040: Request header is too large.
> java.nio.BufferOverflowException
>     at
> com.sun.grizzly.tcp.http11.InternalInputBuffer.fill(InternalInputBuffer.java:765)
>     at
> com.sun.grizzly.tcp.http11.InternalInputBuffer.parseHeader(InternalInputBuffer.java:669)
>     at
> com.sun.grizzly.tcp.http11.InternalInputBuffer.parseHeaders(InternalInputBuffer.java:555)
>     at
> com.sun.grizzly.http.ProcessorTask.parseRequest(ProcessorTask.java:881)
>     at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:692)
>     at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
>     at
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>     at
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>     at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>     at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>     at
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>     at
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>     at
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>     at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>     at
> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>     at
> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>     at java.lang.Thread.run(Thread.java:662)

Request header is too large.

Posted by Xue-Feng Yang <ju...@yahoo.com>.
Hi all,

When run DIH  indexing data from database, I run into the following error.

Anyone knows what is the problem?

Thanks,

Xufeng

///////////////////////////////////////////////////

SEVERE: GRIZZLY0040: Request header is too large.
java.nio.BufferOverflowException
    at com.sun.grizzly.tcp.http11.InternalInputBuffer.fill(InternalInputBuffer.java:765)
    at com.sun.grizzly.tcp.http11.InternalInputBuffer.parseHeader(InternalInputBuffer.java:669)
    at com.sun.grizzly.tcp.http11.InternalInputBuffer.parseHeaders(InternalInputBuffer.java:555)
    at com.sun.grizzly.http.ProcessorTask.parseRequest(ProcessorTask.java:881)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:692)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:662)

Re: Solr 4.0-ALPHA and ModifiableSolrParams

Posted by Federico Valeri <fe...@gmail.com>.
OK I definitely need a response parser.
Thank you!

2012/7/28 Erik Hatcher <er...@gmail.com>

> And by parser, what is meant is a ResponseParser.  There is an example in
> one of the Solr 4 test cases that goes like this:
>
>   public void testGetRawFile() throws SolrServerException, IOException {
>     SolrServer server = getSolrServer();
>     //assertQ(req("qt", "/admin/file")); TODO file bug that
> SolrJettyTestBase extends SolrTestCaseJ4
>     QueryRequest request = new QueryRequest(params("file","schema.xml"));
>     request.setPath("/admin/file");
>     final AtomicBoolean readFile = new AtomicBoolean();
>     request.setResponseParser(new ResponseParser() {
>       @Override
>       public String getWriterType() {
>         return "mock";//unfortunately this gets put onto params wt=mock
> but it apparently has no effect
>       }
>
>       @Override
>       public NamedList<Object> processResponse(InputStream body, String
> encoding) {
>         try {
>           if (body.read() >= 0)
>             readFile.set(true);
>         } catch (IOException e) {
>           throw new RuntimeException(e);
>         }
>         return null;
>       }
>
>       @Override
>       public NamedList<Object> processResponse(Reader reader) {
>         throw new UnsupportedOperationException("TODO
> unimplemented");//TODO
>       }
>     });
>
>     server.request( request );//runs request
>     //request.process(server); but we don't have a NamedList response
>     assertTrue(readFile.get());
>   }
>
> So... you can read the JSON, but you'll need to do something like the
> above.
>
>     Erik
>
>
> On Jul 28, 2012, at 08:11 , in.abdul wrote:
>
> > Solrj can support only xml writer and binary writer . It not possible get
> > the response in Json . If your requirement is to get response in Json
> then
> > you have to write parser ..
> > Syed Abdul kather
> > send from Samsung S3
> > On Jul 28, 2012 1:29 AM, "Federico Valeri [via Lucene]" <
> > ml-node+s472066n3997784h30@n3.nabble.com> wrote:
> >
> >> Hi, I'm trying to get a JSON response with this Java code:
> >>
> >> SolrServer solr = new HttpSolrServer("http://localhost:8080/solr");
> >> ModifiableSolrParams params = new ModifiableSolrParams();
> >> params.set("qt", "/select");
> >> params.set("q", "contenuto:(" + query + ")");
> >> params.set("hl", "true");
> >> params.set("hl.fl", "id,contenuto");
> >> params.set("wt", "json");
> >> QueryResponse response = solr.query(params);
> >> log.debug(response.toString());
> >>
> >> but from log i see "&wt=javabin" in query
> >> and "..docs=[SolrDocument{id=452011.." in response ..
> >>
> >> instead I would expect "&wt=json" and "..docs=[{id=452011.."
> >>
> >> What I am missing?
> >>
> >>
> >> ------------------------------
> >> If you reply to this email, your message will be added to the discussion
> >> below:
> >>
> >>
> http://lucene.472066.n3.nabble.com/Solr-4-0-ALPHA-and-ModifiableSolrParams-tp3997784.html
> >> To unsubscribe from Lucene, click here<
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=472066&code=aW4uYWJkdWxAZ21haWwuY29tfDQ3MjA2NnwxMDczOTUyNDEw
> >
> >> .
> >> NAML<
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >>
> >
> >
> >
> >
> > -----
> > THANKS AND REGARDS,
> > SYED ABDUL KATHER
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-4-0-ALPHA-and-ModifiableSolrParams-tp3997784p3997858.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
>
>

Re: Solr 4.0-ALPHA and ModifiableSolrParams

Posted by Erik Hatcher <er...@gmail.com>.
And by parser, what is meant is a ResponseParser.  There is an example in one of the Solr 4 test cases that goes like this:

  public void testGetRawFile() throws SolrServerException, IOException {
    SolrServer server = getSolrServer();
    //assertQ(req("qt", "/admin/file")); TODO file bug that SolrJettyTestBase extends SolrTestCaseJ4
    QueryRequest request = new QueryRequest(params("file","schema.xml"));
    request.setPath("/admin/file");
    final AtomicBoolean readFile = new AtomicBoolean();
    request.setResponseParser(new ResponseParser() {
      @Override
      public String getWriterType() {
        return "mock";//unfortunately this gets put onto params wt=mock but it apparently has no effect
      }

      @Override
      public NamedList<Object> processResponse(InputStream body, String encoding) {
        try {
          if (body.read() >= 0)
            readFile.set(true);
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        return null;
      }

      @Override
      public NamedList<Object> processResponse(Reader reader) {
        throw new UnsupportedOperationException("TODO unimplemented");//TODO
      }
    });

    server.request( request );//runs request
    //request.process(server); but we don't have a NamedList response
    assertTrue(readFile.get());
  }

So... you can read the JSON, but you'll need to do something like the above.

    Erik


On Jul 28, 2012, at 08:11 , in.abdul wrote:

> Solrj can support only xml writer and binary writer . It not possible get
> the response in Json . If your requirement is to get response in Json then
> you have to write parser ..
> Syed Abdul kather
> send from Samsung S3
> On Jul 28, 2012 1:29 AM, "Federico Valeri [via Lucene]" <
> ml-node+s472066n3997784h30@n3.nabble.com> wrote:
> 
>> Hi, I'm trying to get a JSON response with this Java code:
>> 
>> SolrServer solr = new HttpSolrServer("http://localhost:8080/solr");
>> ModifiableSolrParams params = new ModifiableSolrParams();
>> params.set("qt", "/select");
>> params.set("q", "contenuto:(" + query + ")");
>> params.set("hl", "true");
>> params.set("hl.fl", "id,contenuto");
>> params.set("wt", "json");
>> QueryResponse response = solr.query(params);
>> log.debug(response.toString());
>> 
>> but from log i see "&wt=javabin" in query
>> and "..docs=[SolrDocument{id=452011.." in response ..
>> 
>> instead I would expect "&wt=json" and "..docs=[{id=452011.."
>> 
>> What I am missing?
>> 
>> 
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>> 
>> http://lucene.472066.n3.nabble.com/Solr-4-0-ALPHA-and-ModifiableSolrParams-tp3997784.html
>> To unsubscribe from Lucene, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=472066&code=aW4uYWJkdWxAZ21haWwuY29tfDQ3MjA2NnwxMDczOTUyNDEw>
>> .
>> NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>> 
> 
> 
> 
> 
> -----
> THANKS AND REGARDS,
> SYED ABDUL KATHER
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-4-0-ALPHA-and-ModifiableSolrParams-tp3997784p3997858.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr 4.0-ALPHA and ModifiableSolrParams

Posted by "in.abdul" <in...@gmail.com>.
Solrj can support only xml writer and binary writer . It not possible get
the response in Json . If your requirement is to get response in Json then
you have to write parser ..
Syed Abdul kather
send from Samsung S3
On Jul 28, 2012 1:29 AM, "Federico Valeri [via Lucene]" <
ml-node+s472066n3997784h30@n3.nabble.com> wrote:

> Hi, I'm trying to get a JSON response with this Java code:
>
> SolrServer solr = new HttpSolrServer("http://localhost:8080/solr");
> ModifiableSolrParams params = new ModifiableSolrParams();
> params.set("qt", "/select");
> params.set("q", "contenuto:(" + query + ")");
> params.set("hl", "true");
> params.set("hl.fl", "id,contenuto");
> params.set("wt", "json");
> QueryResponse response = solr.query(params);
> log.debug(response.toString());
>
> but from log i see "&wt=javabin" in query
> and "..docs=[SolrDocument{id=452011.." in response ..
>
> instead I would expect "&wt=json" and "..docs=[{id=452011.."
>
> What I am missing?
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/Solr-4-0-ALPHA-and-ModifiableSolrParams-tp3997784.html
>  To unsubscribe from Lucene, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=472066&code=aW4uYWJkdWxAZ21haWwuY29tfDQ3MjA2NnwxMDczOTUyNDEw>
> .
> NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




-----
THANKS AND REGARDS,
SYED ABDUL KATHER
--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-4-0-ALPHA-and-ModifiableSolrParams-tp3997784p3997858.html
Sent from the Solr - User mailing list archive at Nabble.com.