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 Prashant Golash <pr...@gmail.com> on 2014/04/12 21:18:05 UTC

Question regarding solrj

Hi Solr Gurus,

I have some doubt related to solrj client.

My scenario is like this:

   - There is a proxy server (Play App) which internally queries solr.
   - The proxy server is called from client side, which uses Solrj library.
   The issue is that I can't change client code. I can only change
   configurations to call different servers, hence I need to use SolrJ.
   - Results are successfully returned from my play app in
*java-bin*format without modify them, but on client side, I am
receiving this
   exception:

Caused by: java.lang.NullPointerException
* at
org.apache.solr.common.util.JavaBinCodec.readExternString(JavaBinCodec.java:689)*
* at
org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:188)*
* at
org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:112)*
* at
org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)*
* at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385)*
* at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)*
* at
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)*
* at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)*
* at
com.ibm.commerce.foundation.internal.server.services.search.util.SearchQueryHelper.query(SearchQueryHelper.java:125)*
* at
com.ibm.commerce.foundation.server.services.rest.search.processor.solr.SolrRESTSearchExpressionProcessor.performSearch(SolrRESTSearchExpressionProcessor.java:506)*
* at
com.ibm.commerce.foundation.server.services.search.SearchServiceFacade.performSearch(SearchS*
erviceFacade.java:193)

I am not sure, if this exception is related to some issue in response
format or with respect to querying non-solr server from solrj.

Let me know your thoughts

Thanks,
Prashant

Re: Question regarding solrj

Posted by Prashant Golash <pr...@gmail.com>.
Sorry for not replying!!!
It was wrong version of solrj that client was using (As it was third-party
code, we couldn't find out earlier). After fixing the version, things seem
to be working fine.

Thanks for your response!!!


On Sun, Apr 13, 2014 at 7:26 PM, Erick Erickson <er...@gmail.com>wrote:

> You say "I can't change the client". What is the client written in?
> What does it expect? Does it use the same version of SolrJ?
>
> Best,
> Erick
>
> On Sun, Apr 13, 2014 at 6:40 AM, Prashant Golash
> <pr...@gmail.com> wrote:
> > Thanks for your feedback. Following are some more details
> >
> > Version of solr : 4.3.0
> > Version of solrj : 4.3.0
> >
> > The way I am returning response to client:
> >
> >
> > Request Holder is the object containing post process request from client
> > (After renaming few of the fields, and internal to external mapping of
> the
> > fields)
> >
> > *<Snippet of code>*
> >
> > WS.WSRequestHolder requestHolder = WS.url(url);
> > // requestHolder processing of few fields
> > return requestHolder.get().map(
> >                             new F.Function<WS.Response, Result>() {
> >                                 @Override
> >                                 public Result apply(WS.Response response)
> > throws Throwable {
> >                                     System.out.println("Response header:
> "
> > + response.getHeader("Content-Type"));
> >                                     System.out.println("Response: " +
> > response.getBody());
> >                                     *return
> > ok(response.asByteArray()).as(response.getHeader("Content-Type"));*
> >                                 }
> >                             }
> >                     );
> >
> > Thanks,
> > Prashant
> >
> >
> > On Sun, Apr 13, 2014 at 3:35 AM, Furkan KAMACI <furkankamaci@gmail.com
> >wrote:
> >
> >> Hi;
> >>
> >> If you had a chance to change the code at client side I would suggest to
> >> try that:
> >>
> >>
> http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/client/solrj/impl/HttpSolrServer.html#setParser(org.apache.solr.client.solrj.ResponseParser)
> >> There
> >> maybe a problem about character encoding of your Play App and here is
> the
> >> information:
> >>
> >> Javabin is a custom binary format used to write out Solr's response in a
> >> fast and efficient manner. As of Solr 3.1, the JavaBin format has
> changed
> >> to version 2. Version 2 serializes strings differently: instead of
> writing
> >> the number of UTF-16 characters followed by the bytes in Modified UTF-8
> it
> >> writes the number of UTF-8 bytes followed by the bytes in UTF-8.
> >>
> >> Which version of Solr and Solrj do you use respectively? On the other
> hand
> >> if you give us more information I can help you because there may be any
> >> other interesting thing as like here:
> >> https://issues.apache.org/jira/browse/SOLR-5744
> >>
> >> Thanks;
> >> Furkan KAMACI
> >>
> >>
> >> 2014-04-12 22:18 GMT+03:00 Prashant Golash <pr...@gmail.com>:
> >>
> >> > Hi Solr Gurus,
> >> >
> >> > I have some doubt related to solrj client.
> >> >
> >> > My scenario is like this:
> >> >
> >> >    - There is a proxy server (Play App) which internally queries solr.
> >> >    - The proxy server is called from client side, which uses Solrj
> >> library.
> >> >    The issue is that I can't change client code. I can only change
> >> >    configurations to call different servers, hence I need to use
> SolrJ.
> >> >    - Results are successfully returned from my play app in
> >> > *java-bin*format without modify them, but on client side, I am
> >> > receiving this
> >> >    exception:
> >> >
> >> > Caused by: java.lang.NullPointerException
> >> > * at
> >> >
> >> >
> >>
> org.apache.solr.common.util.JavaBinCodec.readExternString(JavaBinCodec.java:689)*
> >> > * at
> >> >
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:188)*
> >> > * at
> >> >
> >>
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:112)*
> >> > * at
> >> >
> >> >
> >>
> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)*
> >> > * at
> >> >
> >> >
> >>
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385)*
> >> > * at
> >> >
> >> >
> >>
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)*
> >> > * at
> >> >
> >> >
> >>
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)*
> >> > * at
> org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)*
> >> > * at
> >> >
> >> >
> >>
> com.ibm.commerce.foundation.internal.server.services.search.util.SearchQueryHelper.query(SearchQueryHelper.java:125)*
> >> > * at
> >> >
> >> >
> >>
> com.ibm.commerce.foundation.server.services.rest.search.processor.solr.SolrRESTSearchExpressionProcessor.performSearch(SolrRESTSearchExpressionProcessor.java:506)*
> >> > * at
> >> >
> >> >
> >>
> com.ibm.commerce.foundation.server.services.search.SearchServiceFacade.performSearch(SearchS*
> >> > erviceFacade.java:193)
> >> >
> >> > I am not sure, if this exception is related to some issue in response
> >> > format or with respect to querying non-solr server from solrj.
> >> >
> >> > Let me know your thoughts
> >> >
> >> > Thanks,
> >> > Prashant
> >> >
> >>
>

Re: Question regarding solrj

Posted by Erick Erickson <er...@gmail.com>.
You say "I can't change the client". What is the client written in?
What does it expect? Does it use the same version of SolrJ?

Best,
Erick

On Sun, Apr 13, 2014 at 6:40 AM, Prashant Golash
<pr...@gmail.com> wrote:
> Thanks for your feedback. Following are some more details
>
> Version of solr : 4.3.0
> Version of solrj : 4.3.0
>
> The way I am returning response to client:
>
>
> Request Holder is the object containing post process request from client
> (After renaming few of the fields, and internal to external mapping of the
> fields)
>
> *<Snippet of code>*
>
> WS.WSRequestHolder requestHolder = WS.url(url);
> // requestHolder processing of few fields
> return requestHolder.get().map(
>                             new F.Function<WS.Response, Result>() {
>                                 @Override
>                                 public Result apply(WS.Response response)
> throws Throwable {
>                                     System.out.println("Response header: "
> + response.getHeader("Content-Type"));
>                                     System.out.println("Response: " +
> response.getBody());
>                                     *return
> ok(response.asByteArray()).as(response.getHeader("Content-Type"));*
>                                 }
>                             }
>                     );
>
> Thanks,
> Prashant
>
>
> On Sun, Apr 13, 2014 at 3:35 AM, Furkan KAMACI <fu...@gmail.com>wrote:
>
>> Hi;
>>
>> If you had a chance to change the code at client side I would suggest to
>> try that:
>>
>> http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/client/solrj/impl/HttpSolrServer.html#setParser(org.apache.solr.client.solrj.ResponseParser)
>> There
>> maybe a problem about character encoding of your Play App and here is the
>> information:
>>
>> Javabin is a custom binary format used to write out Solr's response in a
>> fast and efficient manner. As of Solr 3.1, the JavaBin format has changed
>> to version 2. Version 2 serializes strings differently: instead of writing
>> the number of UTF-16 characters followed by the bytes in Modified UTF-8 it
>> writes the number of UTF-8 bytes followed by the bytes in UTF-8.
>>
>> Which version of Solr and Solrj do you use respectively? On the other hand
>> if you give us more information I can help you because there may be any
>> other interesting thing as like here:
>> https://issues.apache.org/jira/browse/SOLR-5744
>>
>> Thanks;
>> Furkan KAMACI
>>
>>
>> 2014-04-12 22:18 GMT+03:00 Prashant Golash <pr...@gmail.com>:
>>
>> > Hi Solr Gurus,
>> >
>> > I have some doubt related to solrj client.
>> >
>> > My scenario is like this:
>> >
>> >    - There is a proxy server (Play App) which internally queries solr.
>> >    - The proxy server is called from client side, which uses Solrj
>> library.
>> >    The issue is that I can't change client code. I can only change
>> >    configurations to call different servers, hence I need to use SolrJ.
>> >    - Results are successfully returned from my play app in
>> > *java-bin*format without modify them, but on client side, I am
>> > receiving this
>> >    exception:
>> >
>> > Caused by: java.lang.NullPointerException
>> > * at
>> >
>> >
>> org.apache.solr.common.util.JavaBinCodec.readExternString(JavaBinCodec.java:689)*
>> > * at
>> > org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:188)*
>> > * at
>> >
>> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:112)*
>> > * at
>> >
>> >
>> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)*
>> > * at
>> >
>> >
>> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385)*
>> > * at
>> >
>> >
>> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)*
>> > * at
>> >
>> >
>> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)*
>> > * at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)*
>> > * at
>> >
>> >
>> com.ibm.commerce.foundation.internal.server.services.search.util.SearchQueryHelper.query(SearchQueryHelper.java:125)*
>> > * at
>> >
>> >
>> com.ibm.commerce.foundation.server.services.rest.search.processor.solr.SolrRESTSearchExpressionProcessor.performSearch(SolrRESTSearchExpressionProcessor.java:506)*
>> > * at
>> >
>> >
>> com.ibm.commerce.foundation.server.services.search.SearchServiceFacade.performSearch(SearchS*
>> > erviceFacade.java:193)
>> >
>> > I am not sure, if this exception is related to some issue in response
>> > format or with respect to querying non-solr server from solrj.
>> >
>> > Let me know your thoughts
>> >
>> > Thanks,
>> > Prashant
>> >
>>

Re: Question regarding solrj

Posted by Prashant Golash <pr...@gmail.com>.
Thanks for your feedback. Following are some more details

Version of solr : 4.3.0
Version of solrj : 4.3.0

The way I am returning response to client:


Request Holder is the object containing post process request from client
(After renaming few of the fields, and internal to external mapping of the
fields)

*<Snippet of code>*

WS.WSRequestHolder requestHolder = WS.url(url);
// requestHolder processing of few fields
return requestHolder.get().map(
                            new F.Function<WS.Response, Result>() {
                                @Override
                                public Result apply(WS.Response response)
throws Throwable {
                                    System.out.println("Response header: "
+ response.getHeader("Content-Type"));
                                    System.out.println("Response: " +
response.getBody());
                                    *return
ok(response.asByteArray()).as(response.getHeader("Content-Type"));*
                                }
                            }
                    );

Thanks,
Prashant


On Sun, Apr 13, 2014 at 3:35 AM, Furkan KAMACI <fu...@gmail.com>wrote:

> Hi;
>
> If you had a chance to change the code at client side I would suggest to
> try that:
>
> http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/client/solrj/impl/HttpSolrServer.html#setParser(org.apache.solr.client.solrj.ResponseParser)
> There
> maybe a problem about character encoding of your Play App and here is the
> information:
>
> Javabin is a custom binary format used to write out Solr's response in a
> fast and efficient manner. As of Solr 3.1, the JavaBin format has changed
> to version 2. Version 2 serializes strings differently: instead of writing
> the number of UTF-16 characters followed by the bytes in Modified UTF-8 it
> writes the number of UTF-8 bytes followed by the bytes in UTF-8.
>
> Which version of Solr and Solrj do you use respectively? On the other hand
> if you give us more information I can help you because there may be any
> other interesting thing as like here:
> https://issues.apache.org/jira/browse/SOLR-5744
>
> Thanks;
> Furkan KAMACI
>
>
> 2014-04-12 22:18 GMT+03:00 Prashant Golash <pr...@gmail.com>:
>
> > Hi Solr Gurus,
> >
> > I have some doubt related to solrj client.
> >
> > My scenario is like this:
> >
> >    - There is a proxy server (Play App) which internally queries solr.
> >    - The proxy server is called from client side, which uses Solrj
> library.
> >    The issue is that I can't change client code. I can only change
> >    configurations to call different servers, hence I need to use SolrJ.
> >    - Results are successfully returned from my play app in
> > *java-bin*format without modify them, but on client side, I am
> > receiving this
> >    exception:
> >
> > Caused by: java.lang.NullPointerException
> > * at
> >
> >
> org.apache.solr.common.util.JavaBinCodec.readExternString(JavaBinCodec.java:689)*
> > * at
> > org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:188)*
> > * at
> >
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:112)*
> > * at
> >
> >
> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)*
> > * at
> >
> >
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385)*
> > * at
> >
> >
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)*
> > * at
> >
> >
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)*
> > * at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)*
> > * at
> >
> >
> com.ibm.commerce.foundation.internal.server.services.search.util.SearchQueryHelper.query(SearchQueryHelper.java:125)*
> > * at
> >
> >
> com.ibm.commerce.foundation.server.services.rest.search.processor.solr.SolrRESTSearchExpressionProcessor.performSearch(SolrRESTSearchExpressionProcessor.java:506)*
> > * at
> >
> >
> com.ibm.commerce.foundation.server.services.search.SearchServiceFacade.performSearch(SearchS*
> > erviceFacade.java:193)
> >
> > I am not sure, if this exception is related to some issue in response
> > format or with respect to querying non-solr server from solrj.
> >
> > Let me know your thoughts
> >
> > Thanks,
> > Prashant
> >
>

Re: Question regarding solrj

Posted by Furkan KAMACI <fu...@gmail.com>.
Hi;

If you had a chance to change the code at client side I would suggest to
try that:
http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/client/solrj/impl/HttpSolrServer.html#setParser(org.apache.solr.client.solrj.ResponseParser)
There
maybe a problem about character encoding of your Play App and here is the
information:

Javabin is a custom binary format used to write out Solr's response in a
fast and efficient manner. As of Solr 3.1, the JavaBin format has changed
to version 2. Version 2 serializes strings differently: instead of writing
the number of UTF-16 characters followed by the bytes in Modified UTF-8 it
writes the number of UTF-8 bytes followed by the bytes in UTF-8.

Which version of Solr and Solrj do you use respectively? On the other hand
if you give us more information I can help you because there may be any
other interesting thing as like here:
https://issues.apache.org/jira/browse/SOLR-5744

Thanks;
Furkan KAMACI


2014-04-12 22:18 GMT+03:00 Prashant Golash <pr...@gmail.com>:

> Hi Solr Gurus,
>
> I have some doubt related to solrj client.
>
> My scenario is like this:
>
>    - There is a proxy server (Play App) which internally queries solr.
>    - The proxy server is called from client side, which uses Solrj library.
>    The issue is that I can't change client code. I can only change
>    configurations to call different servers, hence I need to use SolrJ.
>    - Results are successfully returned from my play app in
> *java-bin*format without modify them, but on client side, I am
> receiving this
>    exception:
>
> Caused by: java.lang.NullPointerException
> * at
>
> org.apache.solr.common.util.JavaBinCodec.readExternString(JavaBinCodec.java:689)*
> * at
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:188)*
> * at
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:112)*
> * at
>
> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)*
> * at
>
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385)*
> * at
>
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)*
> * at
>
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)*
> * at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)*
> * at
>
> com.ibm.commerce.foundation.internal.server.services.search.util.SearchQueryHelper.query(SearchQueryHelper.java:125)*
> * at
>
> com.ibm.commerce.foundation.server.services.rest.search.processor.solr.SolrRESTSearchExpressionProcessor.performSearch(SolrRESTSearchExpressionProcessor.java:506)*
> * at
>
> com.ibm.commerce.foundation.server.services.search.SearchServiceFacade.performSearch(SearchS*
> erviceFacade.java:193)
>
> I am not sure, if this exception is related to some issue in response
> format or with respect to querying non-solr server from solrj.
>
> Let me know your thoughts
>
> Thanks,
> Prashant
>