使用 solrj 5.5.0 和 java 1.7 时出现验证错误
Having a verify error with solrj 5.5.0 and java 1.7
我在执行 HttpSolrClient solr = new HttpSolrClient("http://localhost:8983/solr/mycore");
时遇到 java.lang.VerifyError: Cannot inherit from final class
异常
我将 SolrJ 5.5.0 与 Java 1.7 一起使用。除此之外,我使用 commons-httpclient 3.1。这是我得到的详细错误:
Handler processing failed; nested exception is java.lang.VerifyError: org/apache/http/params/SyncBasicHttpParams] with root cause
java.lang.VerifyError: org/apache/http/params/SyncBasicHttpParams
at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158)
at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:466)
at org.apache.solr.client.solrj.impl.HttpClientUtil.setFollowRedirects(HttpClientUtil.java:290)
at org.apache.solr.client.solrj.impl.HttpClientConfigurer.configure(HttpClientConfigurer.java:58)
at org.apache.solr.client.solrj.impl.HttpClientUtil.configureClient(HttpClientUtil.java:149)
at org.apache.solr.client.solrj.impl.HttpClientUtil.createClient(HttpClientUtil.java:125)
at org.apache.solr.client.solrj.impl.HttpSolrClient.<init>(HttpSolrClient.java:188)
at org.apache.solr.client.solrj.impl.HttpSolrClient.<init>(HttpSolrClient.java:161)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
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)
我的 .m2 文件夹中有 2 个 httpcore 库(来自 axis2 1.6.2 的 httpcore 4.0 和来自 solrj 5.5.0 的 httpcore 4.4.1)。删除 httpcore 4.0 帮助我解决了这个问题。原因是 org.apache.http.params.BasicHttpParams
class 在 httpcore 4.0 中是最终的 class.
我在执行 HttpSolrClient solr = new HttpSolrClient("http://localhost:8983/solr/mycore");
java.lang.VerifyError: Cannot inherit from final class
异常
我将 SolrJ 5.5.0 与 Java 1.7 一起使用。除此之外,我使用 commons-httpclient 3.1。这是我得到的详细错误:
Handler processing failed; nested exception is java.lang.VerifyError: org/apache/http/params/SyncBasicHttpParams] with root cause
java.lang.VerifyError: org/apache/http/params/SyncBasicHttpParams
at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158)
at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:466)
at org.apache.solr.client.solrj.impl.HttpClientUtil.setFollowRedirects(HttpClientUtil.java:290)
at org.apache.solr.client.solrj.impl.HttpClientConfigurer.configure(HttpClientConfigurer.java:58)
at org.apache.solr.client.solrj.impl.HttpClientUtil.configureClient(HttpClientUtil.java:149)
at org.apache.solr.client.solrj.impl.HttpClientUtil.createClient(HttpClientUtil.java:125)
at org.apache.solr.client.solrj.impl.HttpSolrClient.<init>(HttpSolrClient.java:188)
at org.apache.solr.client.solrj.impl.HttpSolrClient.<init>(HttpSolrClient.java:161)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
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)
我的 .m2 文件夹中有 2 个 httpcore 库(来自 axis2 1.6.2 的 httpcore 4.0 和来自 solrj 5.5.0 的 httpcore 4.4.1)。删除 httpcore 4.0 帮助我解决了这个问题。原因是 org.apache.http.params.BasicHttpParams
class 在 httpcore 4.0 中是最终的 class.