このコードを使用してsolrサーバーに接続しようとしています:
SolrServer solr = new HttpSolrServer("http://localhost:8080/solr-all");
SolrQuery query = new SolrQuery();
query.setQuery("*:*");
query.setRows(10);
query.setStart(0);
QueryResponse response = solr.query(query);
System.out.println(response);
しかし、私はこのエラーが発生します:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Server at http://localhost:8080/solr-all returned non ok status:401, message:Unauthorized
ユーザー名とパスワードの設定方法が本当にわかりません。ウェブ上で多くの例を見つけましたhtttpclient
が、どれもうまくいきませんでした。