Reply
Highlighted
New Contributor
Posts: 1
Registered: ‎08-07-2017

Unable to access Solr from WAS 9.0 (java , solrj)

Hello, we have a problem to consume SOLR using SOLRJ in JAVA 1.8 and implemented in WAS 9.0

 

We have a 5.10 cloudera version, with kerberos security on.

 

We did a example of connection in JAVA which the following code:

 

package ar.com.bigdata.test;

 

import org.apache.solr.client.solrj.SolrQuery;

import org.apache.solr.client.solrj.impl.HttpClientUtil;

import org.apache.solr.client.solrj.impl.HttpSolrServer;

import org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer;

import org.apache.solr.client.solrj.impl.NoOpResponseParser;

import org.apache.solr.client.solrj.request.QueryRequest;

import org.apache.solr.common.util.NamedList;

import org.springframework.http.MediaType;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;

import org.springframework.web.bind.annotation.RestController;

 

@RestController

@RequestMapping("/Test")

public class TestController {

 

      

      

      

       @RequestMapping(value= "/autenticar", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

       public String GetTransferencia() {

            

             System.setProperty("java.security.auth.login.config", "/xxx/xxxx/Security/jaas_keytab.conf");

 

            

             HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());

             HttpSolrServer solr = new HttpSolrServer(

                           "https://server:port/solr/colecction");

 

 

             SolrQuery q = new SolrQuery();

             q.setRows(new Integer(50));

             q.set("q", "*:*");

                                       

             NamedList<Object> response = null;

             try {

                   

                    NoOpResponseParser dontMessWithSolr = new NoOpResponseParser();

                    dontMessWithSolr.setWriterType("json");

                    ((HttpSolrServer)solr).setParser(dontMessWithSolr);

                                                           

                    QueryRequest req = new QueryRequest(q);

                    System.out.println("CONSULTA SIN PARSEAR: ");

                    response = solr.request(req);                        

                    System.out.println("SERVICIO AUTENTICAR: Se realizo la query con SOLRJ SIN PARSER Y DEVOLVIO: " + response.toString());

 

                   

             } catch (Exception e) {

                    System.out.println("SERVICIO AUTENTICAR: Error al realizar la query con SOLRJ");

                    e.printStackTrace();

                    System.out.println(e.getMessage());

 

             }

             return response.toString();

       }

}

 

 

and which gives us the following error:

 

"org.ietf.jgss.GSSException, major code: 11, minor code: 0 major string:

General failure, unspecified at GSSAPI level minor string: Failed to set up context "

 

 

Any pointer or help is truly appreciated.

 

 

 

 

Announcements