我正在将maven
用于我的项目和此依赖项:
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>9.2.0</version>
</dependency>
字符串
Java版本:17
个
Spring Boot版本:2.7.13
个
代码中的用法:
@Bean
public SolrClient solrClient() {
return new Http2SolrClient.Builder(host).build();
}
型
我有正确的主机与HttpSolrClient
(弃用),但没有与Http2SolrClient
。
构建成功-应用程序运行时出错:
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/http/HttpFields$Mutable
at org.apache.solr.client.solrj.impl.Http2SolrClient$Builder.<init>
(Http2SolrClient.java:992)
型
我试着添加任何版本的org.eclipse.jetty
-没有帮助。
在文档中-9.2.0版应支持Http 2SolrClient:https://solr.apache.org/docs/9_2_0/solrj/org/apache/solr/client/solrj/impl/Http2SolrClient.html
如何正确地创建一个可工作的Http 2SolrClient?
1条答案
按热度按时间w3nuxt5m1#
似乎我找到了答案,这个问题是几个月前在这里咨询的:
https://issues.apache.org/jira/browse/SOLR-16668?jql=text%20~%20%22Http2SolrClient%20HttpFields%22
所以
"forcing all the jetty dependencies to a specific version"
适用于这种情况:字符串
" the problem I have with SolrJ 9.2.0 is caused somehow by Spring Boot, because they override the version of Jetty."
个