Hi,

Receiving NPE when trying to index into solr collection.

Initializing the HTTPSolrClient like this..

HttpSolrClient client = new HttpSolrClient.Builder()
                                .withKerberosDelegationToken(token)
                                .withHttpClient(httpClient)
                                .withBaseSolrUrl(baseUrl)
                                .build();

Retrieving the token using the function provided in the documentation.

           private static String getDelegationToken(final String renewer, final
String user, HttpSolrClient solrClient) throws Exception {
                    DelegationTokenRequest.Get get = new
DelegationTokenRequest.Get(renewer) {
                      @Override
                      public SolrParams getParams() {
                        ModifiableSolrParams params = new
ModifiableSolrParams(super.getParams());
                        params.set("user", user);
                        return params;
                      }
                    };
                    DelegationTokenResponse.Get getResponse = 
get.process(solrClient);
                    return getResponse.getDelegationToken();
           }


I am able to getDocumentById successfully using the token but unable to
add/delete into collection. When I remove the ".withKerberosDelegationToken"
line and use keytab file it can index correctly. Does anyone know why I am
running into NPE?

The NPE seems to be coming from this line.

       SolrParams params = request.getParams();
    ->    if (params.getParams("delegation") != null) {




java.lang.NullPointerException
        at
org.apache.solr.client.solrj.impl.DelegationTokenHttpSolrClient.createMethod(DelegationTokenHttpSolrClient.java:93)
        at
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:251)
        at
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:242)
        at 
org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:178)
        at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:173)
        at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:138)
        at testAdd.main(testAdd.java:111)



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply via email to