[ https://issues.apache.org/jira/browse/OFBIZ-9444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16071307#comment-16071307 ]
Michael Brohl edited comment on OFBIZ-9444 at 7/9/17 11:28 AM: --------------------------------------------------------------- I was able to successfully run the tests with the following configuration in the main build.gradle file: {code:java} configurations.all { resolutionStrategy { // force certain versions of dependencies (including transitive) // *append new forced modules: force 'com.google.guava:guava:20.0' // *replace existing forced modules with new ones: forcedModules = ['com.google.guava:guava:20.0'] } } {code} The Guava 22 files are not loaded by Gradle then. The tests fail if I put this configuration in the Solr plugin build.gradle file. The Guava 22 version is loaded and the tests fail. I know that this is not an acceptable solution because it introduces dependencies (or configurations) for a plugin in the base project. Any hints how to force a certain dependency version using the child project build file instead of the main build file? was (Author: mbrohl): I was able to successfully run the tests with the following configuration in the main build.gradle file: {code:java} configurations.all { resolutionStrategy { // force certain versions of dependencies (including transitive) // *append new forced modules: force 'com.google.guava:guava:20.0' // *replace existing forced modules with new ones: forcedModules = ['com.google.guava:guava:20.0'] } } {code} The Guava 22 files are not loaded by Cradle then. The tests fail if I put this configuration in the Solr plugin build.gradle file. The Guava 22 version is loaded and the tests fail. I know that this is not an acceptable solution because it introduces dependencies (or configurations) for a plugin in the base project. Any hints how to force a certain dependency version using the child project build file instead of the main build file? > Dependency problem between Solr 6.6.0 and Guava > ----------------------------------------------- > > Key: OFBIZ-9444 > URL: https://issues.apache.org/jira/browse/OFBIZ-9444 > Project: OFBiz > Issue Type: Sub-task > Components: solr > Affects Versions: Trunk > Reporter: Michael Brohl > Assignee: Renuka Srishti > Attachments: dependencies.txt, OFBIZ-9444.patch > > > 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 > {code:java} > dependencies { > pluginLibsCompile 'org.apache.solr:solr-core:6.6.0' > pluginLibsCompile 'com.google.guava:guava:20.0' > } > {code} > and also as a runtime dependency in main build.gradle > {code:java} > dependencies { > // ofbiz compile libs > ... > runtime 'com.google.guava:guava:20.0' > ... > } > {code} > Both did not work. Running my Solo tests I get the error > {code:java} > 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 > {code} > After removing my grade cache and doing a fresh > {code:java} > ./gradlew cleanAll loadAll testIntegration > {code} > 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 -- This message was sent by Atlassian JIRA (v6.4.14#64029)