SolrJ 9.3.0 升级问题

问题描述 投票:0回答:1

我正在尝试将当前项目升级到SolrJ 9.3.0。为了给您提供上下文,我们有一个通用索引库,它依赖于 SolrJ 以及该库的具体实现来支持不同文档的索引。

当我将 SolrJ 从 8.11.2 升级到 9.3.0 时,出现了不同的问题。主要是,测试失败是因为找不到传递依赖类,然后在具体实现项目中,它再次选择 8.11.2 而不是 9.3.0。我已经清理了 .m2 存储库,但它再次获取了 8.11.2。然后我们尝试另一台机器,但那里发生了同样的行为。我将列出所有依赖项、依赖项树和发生的问题。

谢谢

索引库依赖项:

pom.xml 用于索引库的 URL

索引 Lib 依赖树:

[INFO] --- maven-dependency-plugin:3.3.0:tree (default-cli) @ search-solr-indexing-lib ---
[INFO] com.xxx.search:search-solr-indexing-lib:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.7.15:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.7.15:compile
[INFO] |  |  \- org.springframework:spring-context:jar:5.3.29:compile
[INFO] |  |     +- org.springframework:spring-beans:jar:5.3.29:compile
[INFO] |  |     \- org.springframework:spring-expression:jar:5.3.29:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.7.15:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.7.15:compile
[INFO] |  |  +- ch.qos.logback:logback-classic:jar:1.2.12:compile
[INFO] |  |  |  \- ch.qos.logback:logback-core:jar:1.2.12:compile
[INFO] |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile
[INFO] |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.17.2:compile
[INFO] |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.springframework:spring-core:jar:5.3.29:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.3.29:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.30:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-redis:jar:2.7.15:compile
[INFO] |  +- org.springframework.data:spring-data-redis:jar:2.7.15:compile
[INFO] |  |  +- org.springframework.data:spring-data-keyvalue:jar:2.7.15:compile
[INFO] |  |  |  \- org.springframework.data:spring-data-commons:jar:2.7.15:compile
[INFO] |  |  +- org.springframework:spring-tx:jar:5.3.29:compile
[INFO] |  |  +- org.springframework:spring-oxm:jar:5.3.29:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:5.3.29:compile
[INFO] |  |  \- org.springframework:spring-context-support:jar:5.3.29:compile
[INFO] |  \- io.lettuce:lettuce-core:jar:6.1.10.RELEASE:compile
[INFO] |     +- io.netty:netty-common:jar:4.1.97.Final:compile
[INFO] |     +- io.netty:netty-handler:jar:4.1.97.Final:compile
[INFO] |     |  +- io.netty:netty-resolver:jar:4.1.97.Final:compile
[INFO] |     |  \- io.netty:netty-transport-native-unix-common:jar:4.1.97.Final:compile
[INFO] |     +- io.netty:netty-transport:jar:4.1.97.Final:compile
[INFO] |     \- io.projectreactor:reactor-core:jar:3.4.32:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.7.15:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.7.15:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.7.15:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.7.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.4.11:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:2.4.11:test
[INFO] |  |        \- org.ow2.asm:asm:jar:9.3:test
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test
[INFO] |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:test
[INFO] |  +- org.assertj:assertj-core:jar:3.22.0:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.8.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  |  +- org.junit.platform:junit-platform-commons:jar:1.8.2:test
[INFO] |  |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:test
[INFO] |  |     \- org.junit.platform:junit-platform-engine:jar:1.8.2:test
[INFO] |  +- org.mockito:mockito-core:jar:4.5.1:test
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.12.23:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.12.23:test
[INFO] |  |  \- org.objenesis:objenesis:jar:3.2:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:4.5.1:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.1:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-test:jar:5.3.29:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.9.1:test
[INFO] +- com.google.code.gson:gson:jar:2.10.1:compile
[INFO] +- io.github.resilience4j:resilience4j-retry:jar:1.7.1:compile
[INFO] |  +- io.vavr:vavr:jar:0.10.2:compile
[INFO] |  |  \- io.vavr:vavr-match:jar:0.10.2:compile
[INFO] |  +- io.github.resilience4j:resilience4j-core:jar:1.7.1:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] +- org.apache.solr:solr-solrj:jar:9.3.0:compile
[INFO] |  +- org.eclipse.jetty.http2:http2-client:jar:9.4.51.v20230217:compile
[INFO] |  |  +- org.eclipse.jetty.http2:http2-common:jar:9.4.51.v20230217:compile
[INFO] |  |  |  \- org.eclipse.jetty.http2:http2-hpack:jar:9.4.51.v20230217:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-alpn-client:jar:9.4.51.v20230217:compile
[INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.5.14:compile
[INFO] |  +- org.eclipse.jetty.http2:http2-http-client-transport:jar:9.4.51.v20230217:runtime
[INFO] |  +- org.eclipse.jetty:jetty-http:jar:9.4.51.v20230217:compile
[INFO] |  +- org.eclipse.jetty:jetty-client:jar:9.4.51.v20230217:runtime
[INFO] |  +- org.eclipse.jetty:jetty-util:jar:9.4.51.v20230217:compile
[INFO] |  +- org.eclipse.jetty:jetty-io:jar:9.4.51.v20230217:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
[INFO] |  |  \- commons-codec:commons-codec:jar:1.15:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
[INFO] |  +- org.eclipse.jetty:jetty-alpn-java-client:jar:9.4.51.v20230217:runtime
[INFO] |  +- org.apache.solr:solr-solrj-streaming:jar:9.3.0:runtime
[INFO] |  |  \- org.apache.commons:commons-math3:jar:3.6.1:runtime
[INFO] |  \- org.apache.solr:solr-solrj-zookeeper:jar:9.3.0:runtime
[INFO] |     +- org.apache.zookeeper:zookeeper:jar:3.8.1:runtime
[INFO] |     |  \- io.netty:netty-transport-native-epoll:jar:4.1.97.Final:runtime
[INFO] |     \- org.apache.zookeeper:zookeeper-jute:jar:3.8.1:runtime
[INFO] +- software.amazon.awssdk:s3:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:aws-xml-protocol:jar:2.15.0:compile
[INFO] |  |  \- software.amazon.awssdk:aws-query-protocol:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:protocol-core:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:arns:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:profiles:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:sdk-core:jar:2.15.0:compile
[INFO] |  |  \- org.reactivestreams:reactive-streams:jar:1.0.4:compile
[INFO] |  +- software.amazon.awssdk:http-client-spi:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:regions:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:annotations:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:utils:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:aws-core:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:metrics-spi:jar:2.15.0:compile
[INFO] |  +- software.amazon.awssdk:apache-client:jar:2.15.0:runtime
[INFO] |  \- software.amazon.awssdk:netty-nio-client:jar:2.15.0:runtime
[INFO] |     +- io.netty:netty-codec-http:jar:4.1.97.Final:runtime
[INFO] |     +- io.netty:netty-codec-http2:jar:4.1.97.Final:runtime
[INFO] |     +- io.netty:netty-codec:jar:4.1.97.Final:compile
[INFO] |     +- io.netty:netty-buffer:jar:4.1.97.Final:compile
[INFO] |     +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.97.Final:runtime
[INFO] |     |  \- io.netty:netty-transport-classes-epoll:jar:4.1.97.Final:runtime
[INFO] |     \- com.typesafe.netty:netty-reactive-streams-http:jar:2.0.4:runtime
[INFO] |        \- com.typesafe.netty:netty-reactive-streams:jar:2.0.4:runtime
[INFO] +- software.amazon.awssdk:auth:jar:2.15.0:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.5:compile
[INFO] |  \- software.amazon.eventstream:eventstream:jar:1.0.1:compile
[INFO] +- org.apache.commons:commons-collections4:jar:4.4:compile
[INFO] +- redis.clients:jedis:jar:3.9.0:compile
[INFO] |  \- org.apache.commons:commons-pool2:jar:2.11.1:compile
[INFO] +- com.joyent.util:fast-md5:jar:2.7.1:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.15.2:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.5:compile
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.15.2:compile
[INFO] |  +- org.codehaus.woodstox:stax2-api:jar:4.2.1:compile
[INFO] |  \- com.fasterxml.woodstox:woodstox-core:jar:6.5.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.15.2:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.13.0:compile
[INFO] +- commons-io:commons-io:jar:2.13.0:compile
[INFO] +- com.google.api-client:google-api-client:jar:2.0.0:compile
[INFO] |  +- com.google.oauth-client:google-oauth-client:jar:1.34.1:compile
[INFO] |  +- com.google.http-client:google-http-client-gson:jar:1.42.1:compile
[INFO] |  +- com.google.guava:guava:jar:31.1-jre:compile
[INFO] |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.11.0:compile
[INFO] |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  +- com.google.http-client:google-http-client-apache-v2:jar:1.42.1:compile
[INFO] |  \- com.google.http-client:google-http-client:jar:1.42.1:compile
[INFO] |     +- io.opencensus:opencensus-api:jar:0.31.1:compile
[INFO] |     |  \- io.grpc:grpc-context:jar:1.27.2:compile
[INFO] |     \- io.opencensus:opencensus-contrib-http-util:jar:0.31.1:compile
[INFO] +- com.google.oauth-client:google-oauth-client-jetty:jar:1.34.1:compile
[INFO] |  \- com.google.oauth-client:google-oauth-client-java6:jar:1.34.1:compile
[INFO] +- com.google.apis:google-api-services-sheets:jar:v4-rev20220927-2.0.0:compile
[INFO] +- com.google.auth:google-auth-library-oauth2-http:jar:1.19.0:compile
[INFO] |  +- com.google.auto.value:auto-value-annotations:jar:1.10.1:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  \- com.google.auth:google-auth-library-credentials:jar:1.19.0:compile
[INFO] +- com.oracle.database.jdbc:ojdbc10:jar:19.20.0.0:compile
[INFO] +- org.postgresql:postgresql:jar:42.6.0:compile
[INFO] |  \- org.checkerframework:checker-qual:jar:3.31.0:compile
[INFO] +- org.testcontainers:postgresql:jar:1.18.0:test
[INFO] |  \- org.testcontainers:jdbc:jar:1.18.0:test
[INFO] |     \- org.testcontainers:database-commons:jar:1.18.0:test
[INFO] |        \- org.testcontainers:testcontainers:jar:1.18.0:test
[INFO] |           +- junit:junit:jar:4.13.2:test
[INFO] |           |  \- org.hamcrest:hamcrest-core:jar:2.2:test
[INFO] |           +- org.apache.commons:commons-compress:jar:1.22:test
[INFO] |           +- org.rnorth.duct-tape:duct-tape:jar:1.0.8:test
[INFO] |           |  \- org.jetbrains:annotations:jar:17.0.0:test
[INFO] |           +- com.github.docker-java:docker-java-api:jar:3.3.0:test
[INFO] |           \- com.github.docker-java:docker-java-transport-zerodep:jar:3.3.0:test
[INFO] |              +- com.github.docker-java:docker-java-transport:jar:3.3.0:test
[INFO] |              \- net.java.dev.jna:jna:jar:5.12.1:test
[INFO] \- org.testcontainers:oracle-xe:jar:1.19.0:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.643 s
[INFO] Finished at: 2023-09-25T20:01:50+04:00
[INFO] ------------------------------------------------------------------------

运行“mvn clean install”时索引库问题

Underlying exception : java.lang.IllegalArgumentException: Could not create type
    at com.XXX.search.service.SolrServiceImplTest.init(SolrServiceImplTest.java:41)
Caused by: java.lang.IllegalArgumentException: Could not create type
    at com.XXX.search.service.SolrServiceImplTest.init(SolrServiceImplTest.java:41)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/http/HttpFields$Mutable
    at com.XXX.search.service.SolrServiceImplTest.init(SolrServiceImplTest.java:41)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.http.HttpFields$Mutable
    at com.xxx.search.service.SolrServiceImplTest.init(SolrServiceImplTest.java:41)
[ERROR] test_canRetryAddDocumentsIfStatusIsNonZero  Time elapsed: 0.004 s  <<< ERROR!
org.mockito.exceptions.base.MockitoException: 
Mockito cannot mock this class: class org.apache.solr.client.solrj.impl.Http2SolrClient.
Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.
Java               : 17
JVM vendor name    : Amazon.com Inc.
JVM vendor version : 17.0.8.1+8-LTS
JVM name           : OpenJDK 64-Bit Server VM
JVM version        : 17.0.8.1+8-LTS
JVM info           : mixed mode, sharing
OS name            : Windows 11
OS version         : 10.0

现在假设我没有运行测试并且能够构建项目来检查它在索引作业的具体实现中的使用情况。

具体索引工作pom POM链接

它的依赖树表明,当我将 9.3.0 放入 pom 中时,lib 使用 8.11.2,甚至 lib 也识别 9.3.0 :) .m2 存储库已清理,我已经使用 0.0.2-SNAPSHOT 版本构建了 lib,即即使不在神器中..这是依赖树:

[INFO] --- maven-dependency-plugin:3.3.0:tree (default-cli) @ search-solr-indexing-rq ---
[INFO] com.xxx.search:search-solr-indexing-rq:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.7.15:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.7.15:compile
[INFO] |  |  \- org.springframework:spring-context:jar:5.3.29:compile
[INFO] |  |     +- org.springframework:spring-aop:jar:5.3.29:compile
[INFO] |  |     +- org.springframework:spring-beans:jar:5.3.29:compile
[INFO] |  |     \- org.springframework:spring-expression:jar:5.3.29:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.7.15:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.7.15:compile
[INFO] |  |  +- ch.qos.logback:logback-classic:jar:1.2.12:compile
[INFO] |  |  |  \- ch.qos.logback:logback-core:jar:1.2.12:compile
[INFO] |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile
[INFO] |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.17.2:compile
[INFO] |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.springframework:spring-core:jar:5.3.29:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.3.29:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.30:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.7.15:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.7.15:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.7.15:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.7.0:test
[INFO] |  |  +- net.minidev:json-smart:jar:2.4.11:test
[INFO] |  |  |  \- net.minidev:accessors-smart:jar:2.4.11:test
[INFO] |  |  |     \- org.ow2.asm:asm:jar:9.3:test
[INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test
[INFO] |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:test
[INFO] |  +- org.assertj:assertj-core:jar:3.22.0:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.8.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  |  +- org.junit.platform:junit-platform-commons:jar:1.8.2:test
[INFO] |  |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:test
[INFO] |  |     \- org.junit.platform:junit-platform-engine:jar:1.8.2:test
[INFO] |  +- org.mockito:mockito-core:jar:4.5.1:test
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.12.23:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.12.23:test
[INFO] |  |  \- org.objenesis:objenesis:jar:3.2:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:4.5.1:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.1:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-test:jar:5.3.29:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.9.1:test
[INFO] \- com.xxx.search:search-solr-indexing-lib:jar:0.0.2-SNAPSHOT:compile
[INFO]    +- org.springframework.boot:spring-boot-starter-data-redis:jar:2.7.15:compile
[INFO]    |  +- org.springframework.data:spring-data-redis:jar:2.7.15:compile
[INFO]    |  |  +- org.springframework.data:spring-data-keyvalue:jar:2.7.15:compile
[INFO]    |  |  |  \- org.springframework.data:spring-data-commons:jar:2.7.15:compile
[INFO]    |  |  +- org.springframework:spring-tx:jar:5.3.29:compile
[INFO]    |  |  +- org.springframework:spring-oxm:jar:5.3.29:compile
[INFO]    |  |  \- org.springframework:spring-context-support:jar:5.3.29:compile
[INFO]    |  \- io.lettuce:lettuce-core:jar:6.1.10.RELEASE:compile
[INFO]    |     \- io.projectreactor:reactor-core:jar:3.4.32:compile
[INFO]    +- com.google.code.gson:gson:jar:2.9.1:compile
[INFO]    +- io.github.resilience4j:resilience4j-retry:jar:1.7.1:compile
[INFO]    |  +- io.vavr:vavr:jar:0.10.2:compile
[INFO]    |  |  \- io.vavr:vavr-match:jar:0.10.2:compile
[INFO]    |  \- io.github.resilience4j:resilience4j-core:jar:1.7.1:compile
[INFO]    +- org.apache.solr:solr-solrj:jar:8.11.2:compile
[INFO]    |  +- com.fasterxml.woodstox:woodstox-core:jar:6.2.4:compile
[INFO]    |  +- commons-lang:commons-lang:jar:2.6:compile
[INFO]    |  +- io.netty:netty-buffer:jar:4.1.97.Final:compile
[INFO]    |  +- io.netty:netty-codec:jar:4.1.97.Final:compile
[INFO]    |  +- io.netty:netty-common:jar:4.1.97.Final:compile
[INFO]    |  +- io.netty:netty-handler:jar:4.1.97.Final:compile
[INFO]    |  +- io.netty:netty-resolver:jar:4.1.97.Final:compile
[INFO]    |  +- io.netty:netty-transport:jar:4.1.97.Final:compile
[INFO]    |  +- io.netty:netty-transport-native-epoll:jar:4.1.97.Final:compile
[INFO]    |  |  \- io.netty:netty-transport-classes-epoll:jar:4.1.97.Final:compile
[INFO]    |  +- io.netty:netty-transport-native-unix-common:jar:4.1.97.Final:compile
[INFO]    |  +- org.apache.commons:commons-math3:jar:3.6.1:compile
[INFO]    |  +- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
[INFO]    |  +- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
[INFO]    |  +- org.apache.httpcomponents:httpmime:jar:4.5.14:compile
[INFO]    |  +- org.apache.zookeeper:zookeeper:jar:3.6.2:compile
[INFO]    |  +- org.apache.zookeeper:zookeeper-jute:jar:3.6.2:compile
[INFO]    |  +- org.codehaus.woodstox:stax2-api:jar:4.2.1:compile
[INFO]    |  +- org.eclipse.jetty:jetty-alpn-client:jar:9.4.51.v20230217:compile
[INFO]    |  +- org.eclipse.jetty:jetty-alpn-java-client:jar:9.4.51.v20230217:compile
[INFO]    |  +- org.eclipse.jetty:jetty-client:jar:9.4.51.v20230217:compile
[INFO]    |  +- org.eclipse.jetty:jetty-http:jar:9.4.51.v20230217:compile
[INFO]    |  +- org.eclipse.jetty:jetty-io:jar:9.4.51.v20230217:compile
[INFO]    |  +- org.eclipse.jetty:jetty-util:jar:9.4.51.v20230217:compile
[INFO]    |  +- org.eclipse.jetty.http2:http2-client:jar:9.4.51.v20230217:compile
[INFO]    |  +- org.eclipse.jetty.http2:http2-common:jar:9.4.51.v20230217:compile
[INFO]    |  +- org.eclipse.jetty.http2:http2-hpack:jar:9.4.51.v20230217:compile
[INFO]    |  +- org.eclipse.jetty.http2:http2-http-client-transport:jar:9.4.51.v20230217:compile
[INFO]    |  \- org.xerial.snappy:snappy-java:jar:1.1.7.6:compile
[INFO]    +- software.amazon.awssdk:s3:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:aws-xml-protocol:jar:2.15.0:compile
[INFO]    |  |  \- software.amazon.awssdk:aws-query-protocol:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:protocol-core:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:arns:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:profiles:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:sdk-core:jar:2.15.0:compile
[INFO]    |  |  \- org.reactivestreams:reactive-streams:jar:1.0.4:compile
[INFO]    |  +- software.amazon.awssdk:http-client-spi:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:regions:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:annotations:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:utils:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:aws-core:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:metrics-spi:jar:2.15.0:compile
[INFO]    |  +- software.amazon.awssdk:apache-client:jar:2.15.0:runtime
[INFO]    |  \- software.amazon.awssdk:netty-nio-client:jar:2.15.0:runtime
[INFO]    |     +- io.netty:netty-codec-http:jar:4.1.97.Final:runtime
[INFO]    |     +- io.netty:netty-codec-http2:jar:4.1.97.Final:runtime
[INFO]    |     +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.97.Final:runtime
[INFO]    |     \- com.typesafe.netty:netty-reactive-streams-http:jar:2.0.4:runtime
[INFO]    |        \- com.typesafe.netty:netty-reactive-streams:jar:2.0.4:runtime
[INFO]    +- software.amazon.awssdk:auth:jar:2.15.0:compile
[INFO]    |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.5:compile
[INFO]    |  \- software.amazon.eventstream:eventstream:jar:1.0.1:compile
[INFO]    +- org.apache.commons:commons-collections4:jar:4.4:compile
[INFO]    +- redis.clients:jedis:jar:3.8.0:compile
[INFO]    |  \- org.apache.commons:commons-pool2:jar:2.11.1:compile
[INFO]    +- com.joyent.util:fast-md5:jar:2.7.1:compile
[INFO]    +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.5:compile
[INFO]    |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.5:compile
[INFO]    +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.13.5:compile
[INFO]    +- com.fasterxml.jackson.core:jackson-core:jar:2.13.5:compile
[INFO]    +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO]    +- commons-io:commons-io:jar:2.13.0:compile
[INFO]    +- com.google.api-client:google-api-client:jar:2.0.0:compile
[INFO]    |  +- com.google.oauth-client:google-oauth-client:jar:1.34.1:compile
[INFO]    |  +- com.google.http-client:google-http-client-gson:jar:1.42.1:compile
[INFO]    |  +- com.google.guava:guava:jar:31.1-jre:compile
[INFO]    |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO]    |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO]    |  |  +- com.google.errorprone:error_prone_annotations:jar:2.11.0:compile
[INFO]    |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO]    |  +- com.google.http-client:google-http-client-apache-v2:jar:1.42.1:compile
[INFO]    |  \- com.google.http-client:google-http-client:jar:1.42.1:compile
[INFO]    |     +- io.opencensus:opencensus-api:jar:0.31.1:compile
[INFO]    |     |  \- io.grpc:grpc-context:jar:1.27.2:compile
[INFO]    |     \- io.opencensus:opencensus-contrib-http-util:jar:0.31.1:compile
[INFO]    +- com.google.oauth-client:google-oauth-client-jetty:jar:1.34.1:compile
[INFO]    |  \- com.google.oauth-client:google-oauth-client-java6:jar:1.34.1:compile
[INFO]    +- com.google.apis:google-api-services-sheets:jar:v4-rev20220927-2.0.0:compile
[INFO]    +- com.google.auth:google-auth-library-oauth2-http:jar:1.19.0:compile
[INFO]    |  +- com.google.auto.value:auto-value-annotations:jar:1.10.1:compile
[INFO]    |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO]    |  \- com.google.auth:google-auth-library-credentials:jar:1.19.0:compile
[INFO]    +- com.oracle.database.jdbc:ojdbc10:jar:19.20.0.0:compile
[INFO]    \- org.postgresql:postgresql:jar:42.3.8:compile
[INFO]       \- org.checkerframework:checker-qual:jar:3.5.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.501 s
[INFO] Finished at: 2023-09-25T20:12:06+04:00
[INFO] ------------------------------------------------------------------------

然后在运行时我们收到此错误

java.lang.NoSuchMethodError: 'org.apache.solr.client.solrj.impl.Http2SolrClient$Builder org.apache.solr.client.solrj.impl.Http2SolrClient$Builder.withResponseParser(org.apache.solr.client.solrj.ResponseParser)'
    at com.xxx.search.service.impl.SolrServiceImpl.initSolrClient(SolrServiceImpl.java:144) ~[search-solr-indexing-lib-0.0.2-SNAPSHOT.jar:0.0.2-SNAPSHOT]
    at com.xxx.search.service.impl.SolrServiceImpl.<init>(SolrServiceImpl.java:38) ~[search-solr-indexing-lib-0.0.2-SNAPSHOT.jar:0.0.2-SNAPSHOT]
    at com.xxx.search.util.SolrServiceFactory.lambda$getSolrServices$0(SolrServiceFactory.java:26) ~[search-solr-indexing-lib-0.0.2-SNAPSHOT.jar:0.0.2-SNAPSHOT]
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
    at com.xxx.search.util.SolrServiceFactory.lambda$getSolrServices$1(SolrServiceFactory.java:26) ~[search-solr-indexing-lib-0.0.2-SNAPSHOT.jar:0.0.2-SNAPSHOT]
    at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134) ~[na:na]
    at com.xxx.search.util.SolrServiceFactory.getSolrServices(SolrServiceFactory.java:26) ~[search-solr-indexing-lib-0.0.2-SNAPSHOT.jar:0.0.2-SNAPSHOT]
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]

我尝试手动添加传递依赖项,但问题仍然存在。

[Transitive dependency list](https://pastebin.com/47zJatcm)
java maven pom.xml solrj solr-9.3.0
1个回答
0
投票

强制jetty版本11和Spring Boot版本3,它将可以工作或Dongrade solrj版本与Spring Boot 3一起使用

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.3.7</version>
</parent>

<dependency>
        <groupId>org.apache.solr</groupId>
        <artifactId>solr-solrj</artifactId>
        <version>9.7.0</version>
</dependency>

    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-client</artifactId>
        <version>11.0.20</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-http</artifactId>
        <version>11.0.20</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-io</artifactId>
        <version>11.0.20</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-util</artifactId>
        <version>11.0.20</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-alpn-client</artifactId>
        <version>11.0.20</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-alpn-java-client</artifactId>
        <version>11.0.20</version>
    </dependency>
© www.soinside.com 2019 - 2024. All rights reserved.