Solr查询错误
报错: Exception in thread "main" 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/conn/ClientConnectionManager;)Lorg/apache/http/impl/client/CloseableHttpClient; @62: areturn Reason: Type 'org/apache/http/impl/client/DefaultHttpClient' (current frame, stack[0]) is not assignable to 'org/apache/http/impl/client/CloseableHttpClient' (from method signature) Current Frame: bci: @62 flags: { } locals: { 'org/apache/solr/common/params/SolrParams', 'org/apache/http/conn/ClientConnectionManager', 'org/apache/solr/common/params/ModifiableSolrParams', 'org/apache/http/impl/client/DefaultHttpClient' } stack: { 'org/apache/http/impl/client/DefaultHttpClient' } Bytecode: 0x0000000: bb00 0359 2ab7 0004 4db2 0005 b900 0601 0x0000010: 0099 001e b200 05bb 0007 59b7 0008 1209 0x0000020: b600 0a2c b600 0bb6 000c b900 0d02 00bb 0x0000030: 0011 592b b700 124e 2d2c b800 102d b0 Stackmap Table: append_frame(@47,Object[#127]) at org.apache.solr.client.solrj.impl.HttpSolrClient.<init>(HttpSolrClient.java:186) at org.apache.solr.client.solrj.impl.HttpSolrClient.<init>(HttpSolrClient.java:159) at org.apache.solr.client.solrj.impl.HttpSolrServer.<init>(HttpSolrServer.java:30) at com.coba.efx.news.server.SolrPopulator.main(SolrPopulator.java:14) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) Process finished with exit code 1
解决办法:
@Test public void find() throws SolrServerException, IOException { SystemDefaultHttpClient httpClient = new SystemDefaultHttpClient(); HttpSolrClient solr = new HttpSolrClient("http://42.***/solr/salehouse_bj",httpClient); SolrQuery solrQuery = new SolrQuery();
增加如上代码的:
SystemDefaultHttpClient httpClient = new SystemDefaultHttpClient();
转载注明出处
如果本文对你有帮助,请帮忙啦~~
打开支付宝首页搜“522901509”领红包,领到大红包的小伙伴赶紧使用哦!