solr 5.3エラーBad return type
solr 5.3次のコードを使用してエラーが発生しました.
エラー入力は次のとおりです.
解決策:
コードを次のように変更します.
HttpSolrClient solrSvr = new HttpSolrClient(url);
SolrQuery query=new SolrQuery();
query.setQuery("xyz");
query.setStart(0);
query.setRows(100);
QueryResponse res=solrSvr.query(query);
SolrDocumentList results=res.getResults();
エラー入力は次のとおりです.
Caused by: java.lang.VerifyError: Bad return type
Exception Details:
Location:
org/apache/solr/client/solrj/impl/HttpClientUtil.createClient(Lorg/apache/solr/common/params/SolrParams;)Lorg/apache/http/impl/client/CloseableHttpClient; @57: areturn
Reason:
Type 'org/apache/http/impl/client/SystemDefaultHttpClient' (current frame, stack[0]) is not assignable to 'org/apache/http/impl/client/CloseableHttpClient' (from method signature)
Current Frame:
bci: @57
flags: { }
locals: { 'org/apache/solr/common/params/SolrParams', 'org/apache/solr/common/params/ModifiableSolrParams', 'org/apache/http/impl/client/SystemDefaultHttpClient' }
stack: { 'org/apache/http/impl/client/SystemDefaultHttpClient' }
解決策:
コードを次のように変更します.
SystemDefaultHttpClient cl = new SystemDefaultHttpClient();
HttpSolrClient solrSvr = new HttpSolrClient(url, cl);