Having problems with Sorl. when trying to run the following line of code:
与Sorl有问题。在尝试运行以下代码行时:
HttpSolrClient solr = new HttpSolrClient.Builder( "http://localhost:8983/solr/core" ).build();
I get the following error: Caused by: java.lang.NoClassDefFoundError:
我收到以下错误:引起:java.lang.NoClassDefFoundError:
org/apache/http/impl/client/SystemDefaultHttpClient
at org.apache.solr.client.solrj.impl.HttpSolrClient.<init>(HttpSolrClient.java:211)
at org.apache.solr.client.solrj.impl.HttpSolrClient.<init>(HttpSolrClient.java:228)
at org.apache.solr.client.solrj.impl.HttpSolrClient$Builder.build(HttpSolrClient.java:890)
I read on a couple posts that it could be a dependency issue with Maven since both Swagger and Sorl use httpClient. I moved my dependencies to the same pom and I wrapped dependencies within the dependencymanagement
tag.
我在几篇帖子中读到,这可能是Maven的依赖问题,因为Swagger和Sorl都使用httpClient。我将依赖项移到了同一个pom中,并在dependencymanagement标记中包含了依赖项。
After doing this I ran the command: mvn dependency:tree -Dverbose
执行此操作后,我运行了命令:mvn dependency:tree -Dverbose
Looking at the tree, it is clear that the duplicate dependency is removed. However, i still get the same error.
查看树,很明显删除了重复的依赖项。但是,我仍然得到同样的错误。
Using:
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>6.6.0</version>
</dependency>
Any help would be appreciated!
任何帮助,将不胜感激!
2
My guess would be that Swagger is pulling in an earlier version of the library.
我的猜测是,Swagger正在推出早期版本的库。
It looks like SystemDefaultHttpClient has only existed since version 4.2.
看起来SystemDefaultHttpClient仅在4.2版本之后才存在。
Does mvn dependency:tree -Dverbose
show the same versions of http client in both cases?
mvn依赖:tree -Dverbose在两种情况下都显示相同版本的http客户端吗?
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2017/07/12/7daf6c43a1ec4bbcdbf0cfee06796a9b.html。