lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Scadden <P.Scad...@gns.cri.nz>
Subject RE: adding documents to a secured solr server.
Date Thu, 02 Nov 2017 01:59:04 GMT
After some digging, I tried this approach...
       solr = new ConcurrentUpdateSolrClient.Builder(solrUrl)
               .withQueueSize(20)
               .build();
             SolrInputDocument up = new SolrInputDocument();
             up.addField("id",f.getCanonicalPath());
             up.addField("title",title);
             up.addField("author",author);
             String content = textHandler.toString();
             up.addField("_text_",content);
             UpdateRequest req = new UpdateRequest();
             req.setCommitWithin(1000);
             req.add(up);
             req.setBasicAuthCredentials("solrAdmin", password);
             UpdateResponse ur =  req.process(solr);

However,  I get error back of:
14:52:45,962 DEBUG ConcurrentUpdateSolrClient:177 - starting runner: org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient$Runner@6eeba4a
14:52:46,224  WARN ConcurrentUpdateSolrClient:343 - Failed to parse error response from http://online-dev.gns.cri.nz:8983/solr/prindex
due to: java.lang.RuntimeException: Invalid version (expected 2, but 60) or the data in not
in 'javabin' format
14:52:46,224 ERROR ConcurrentUpdateSolrClient:540 - error
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at
http://online-dev.gns.cri.nz:8983/solr/prindex: require authentication

request: http://online-dev.gns.cri.nz:8983/solr/prindex/update?wt=javabin&version=2
at org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient$Runner.sendUpdateStream(ConcurrentUpdateSolrClient.java:345)
at org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient$Runner.run(ConcurrentUpdateSolrClient.java:184)
at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:229)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
14:52:46,224 DEBUG ConcurrentUpdateSolrClient:210 - finished: org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient$Runner@6eeba4a

Even more puzzling. Authentication is set. What is the invalid version bit?? I think my solrj
is 6.4.1; the server is 6.6.2. Do these have  to match exactly??

-----Original Message-----
From: Phil Scadden [mailto:P.Scadden@gns.cri.nz]
Sent: Thursday, 2 November 2017 11:28 a.m.
To: solr-user@lucene.apache.org
Subject: adding documents to a secured solr server.

Solrj QueryRequest object has a method to set basic authorization username/password but what
is the equivalent way to pass authorization when you are adding new documents to an index?
       ConcurrentUpdateSolrClient solr = new ConcurrentUpdateSolrClient(solrProperties.getServer(),10,2);
...
             up.addField("id","myid");
             up.addField("title",title);
             up.addField("author",author);
             String content = textHandler.toString();
             up.addField("_text_",content);
             solr.add(up);
             solr.commit();

I cant see where authorization occurs?

Notice: This email and any attachments are confidential and may not be used, published or
redistributed without the prior written consent of the Institute of Geological and Nuclear
Sciences Limited (GNS Science). If received in error please destroy and immediately notify
GNS Science. Do not copy or disclose the contents.
Notice: This email and any attachments are confidential and may not be used, published or
redistributed without the prior written consent of the Institute of Geological and Nuclear
Sciences Limited (GNS Science). If received in error please destroy and immediately notify
GNS Science. Do not copy or disclose the contents.

Mime
View raw message