solr5.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); 

你可能感兴趣的:(return,type,bad,solr5.3)