Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-9440 Refactor the Lucene and Solr Components
  3. OFBIZ-9444

Dependency problem between Solr 6.6.0 and Guava

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: 17.12.01
    • Component/s: solr
    • Labels:
      None

      Description

      It seems we have a dependency problem in our codebase.

      The Solr code needs access to a method com.google.common.base.Objects.firstNonNull, which was removed from Guava from version 21 (see [1]).

      I tried to add the dependency both through the Solr build.gradle with

      dependencies {
          pluginLibsCompile 'org.apache.solr:solr-core:6.6.0'
          pluginLibsCompile 'com.google.guava:guava:20.0'
      }
      

      and also as a runtime dependency in main build.gradle

      dependencies {
          // ofbiz compile libs
      ...
          runtime 'com.google.guava:guava:20.0'
      ...
      }
      

      Both did not work. Running my Solo tests I get the error

      2017-07-01 14:25:18,049 |jsse-nio-8443-exec-4 |HttpSolrCall                  |E| null:java.lang.RuntimeException: java.lang.NoSuchMethodError: com.google.common.base.Objects.firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
              at org.apache.solr.servlet.HttpSolrCall.sendError(HttpSolrCall.java:676)
              at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:544)
              at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:361)
              at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305)
              at org.apache.ofbiz.solr.webapp.OFBizSolrContextFilter.doFilter(OFBizSolrContextFilter.java:151)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.ofbiz.webapp.control.ControlFilter.doFilter(ControlFilter.java:156)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
              at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
              at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
              at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
              at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
              at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
              at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NoSuchMethodError: com.google.common.base.Objects.firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
              at org.apache.solr.handler.component.HighlightComponent.prepare(HighlightComponent.java:118)
              at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:270)
              at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:173)
              at org.apache.solr.core.SolrCore.execute(SolrCore.java:2477)
              at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:723)
              at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:529)
              ... 25 more
      

      After removing my grade cache and doing a fresh

      ./gradlew cleanAll loadAll testIntegration
      

      the cradle cache contains both libraries from Guava 20.0 and 22.0 so I guess there must be some other dependency somewhere.

      [1] https://issues.apache.org/jira/browse/SOLR-10308

        Attachments

        1. dependencies.txt
          262 kB
          Michael Brohl
        2. OFBIZ-9444.patch
          0.5 kB
          Renuka Srishti
        3. OFBIZ-9444_intermediate.patch
          44 kB
          Michael Brohl
        4. OFBIZ-9444_intermediate_clean.patch
          37 kB
          Julian Leichert

          Issue Links

            Activity

              People

              • Assignee:
                mbrohl Michael Brohl
                Reporter:
                mbrohl Michael Brohl
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: