Solr 8.6 search by daterange field throws java.lang.NoClassDefFoundError: com/google/common/util/concurrent/internal/InternalFutureFailureAccess

Solr 8.6 search by daterange field throws java.lang.NoClassDefFoundError: com/google/common/util/concurrent/internal/InternalFutureFailureAccess

我们正在从 Solr 版本 7.7.3 迁移到 8.6.3 并遇到问题,当通过 daterange 字段搜索时 solr trows 异常 java.lang.NoClassDefFoundError: com/google/common/util/concurrent/internal/InternalFutureFailureAccess

但在 7.7.3 中一切正常。架构和数据完全相同。

以下是 schema.xml 的一些定义:

<fieldType name="date" class="solr.DatePointField" docValues="true" sortMissingLast="true" />
<fieldType name="daterange" class="solr.DateRangeField" />

...
<dynamicField name="*_date" type="date" indexed="true" stored="true" />
<dynamicField name="*_date_mv" type="date" indexed="true" stored="true" multiValued="true" />
<dynamicField name="*_daterange" type="daterange" indexed="true" stored="true" />
<dynamicField name="*_daterange_mv" type="daterange" indexed="true" stored="true" multiValued="true" />

所以,这里搜索尝试:

v7.7.7

/select?fq=mydaterangefild_daterange_mv:[2021-04-28T15:00:00Z TO *]

{"responseHeader":{
"status":0,
"QTime":0,
"params":{
  "fq":"mydaterangefild_daterange_mv:[2021-04-28T15:00:00Z TO *]"}},
"response":{"numFound":0,"start":0,"docs":[]
}}

v8.6.3

/select?fq=mydaterangefild_daterange_mv:[2021-04-28T15:00:00Z TO *]

HTTP ERROR 500 java.lang.NoClassDefFoundError: com/google/common/util/concurrent/internal/InternalFutureFailureAccess
URI:    /solr/master_faberlic_local_Product_default/select
STATUS: 500
MESSAGE:    java.lang.NoClassDefFoundError: com/google/common/util/concurrent/internal/InternalFutureFailureAccess
SERVLET:    default
CAUSED BY:  java.lang.NoClassDefFoundError: com/google/common/util/concurrent/internal/InternalFutureFailureAccess
Caused by:
java.lang.NoClassDefFoundError: com/google/common/util/concurrent/internal/InternalFutureFailureAccess
    at com.google.common.cache.LocalCache$LoadingValueReference.<init>(LocalCache.java:3472)
    at com.google.common.cache.LocalCache$LoadingValueReference.<init>(LocalCache.java:3476)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2134)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4848)
    at org.apache.solr.schema.AbstractSpatialFieldType.getStrategy(AbstractSpatialFieldType.java:430)
    at org.apache.solr.schema.AbstractSpatialFieldType.getQueryFromSpatialArgs(AbstractSpatialFieldType.java:359)
    at org.apache.solr.schema.DateRangeField.getSpecializedRangeQuery(DateRangeField.java:177)
    at org.apache.solr.schema.FieldType.getRangeQuery(FieldType.java:877)
    at org.apache.solr.parser.SolrQueryParserBase.getRangeQueryImpl(SolrQueryParserBase.java:1192)
    at org.apache.solr.parser.SolrQueryParserBase.getRangeQuery(SolrQueryParserBase.java:1186)
    at org.apache.solr.parser.QueryParser.Term(QueryParser.java:503)
    at org.apache.solr.parser.QueryParser.Clause(QueryParser.java:278)
    at org.apache.solr.parser.QueryParser.Query(QueryParser.java:162)
    at org.apache.solr.parser.QueryParser.TopLevelQuery(QueryParser.java:131)
    at org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:263)
    at org.apache.solr.search.LuceneQParser.parse(LuceneQParser.java:49)
    at org.apache.solr.search.QParser.getQuery(QParser.java:174)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:209)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:305)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:214)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:2606)
    at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:815)
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:588)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:415)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:345)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191)
    at org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:177)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:516)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle(HttpChannel.java:388)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:279)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:383)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
    at java.base/java.lang.Thread.run(Thread.java:834)

p.s. 在这种情况下,solr 服务器是一个电子商务平台的一部分,并且在一个分发包中提供,这就是为什么我的能力受到限制使用更新版本

p.s.s 我试过最新的8.8.2版本。问题重现。

问题出在不正确的依赖项上。 由于 com.google.guava:failureaccess:1.0,在 Guava 27.0 中被添加为 Guava 的依赖项,它在 solr 分发中丢失

解决办法是在server/solr-webapp/webapp/WEB-INF/lib/

中添加com.google.guava:failureaccess jar

看来这个问题已经解决了,这个lib是在commit的dependencies里面添加的,相信新版本也会包含 https://github.com/apache/solr/commit/be681bd9e0d24085c78c63fe11914faa41f4b813