You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/04/01 11:49:00 UTC

[jira] [Work logged] (CAMEL-14292) Remove unwanted dependency to google-http-client library

     [ https://issues.apache.org/jira/browse/CAMEL-14292?focusedWorklogId=413998&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-413998 ]

ASF GitHub Bot logged work on CAMEL-14292:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Apr/20 11:48
            Start Date: 01/Apr/20 11:48
    Worklog Time Spent: 10m 
      Work Description: haugene commented on pull request #3701: [CAMEL-14292] Fixes NoClassDefFoundError in camel-google-pubsub, references util class from google-http-client
URL: https://github.com/apache/camel/pull/3701
 
 
   I'm still seeing this issue in 2.25.0: https://issues.apache.org/jira/browse/CAMEL-14292
   
   I have removed the remaining references to `com.google.api.client.repackaged.com.google.common.base.Strings`
   which is the main problem.
   
   Also decided to remove the remaining calls to `com.google.api.client.util.Strings` and instead use `org.apache.camel.util.ObjectHelper` as it seemed natural to me to use an internal string util.
   For the GooglePubsubConnectionFactory we're using so many com.google.api.client imports anyways that I was in doubt - but made the same change there.
   
   Let me know if you want any modifications and I'll push it right away. Tested locally and my app now loads without the exception I got before:
   
   ```
   java.lang.NoClassDefFoundError: com/google/api/client/repackaged/com/google/common/base/Strings
   	at org.apache.camel.component.google.pubsub.consumer.PubsubAcknowledgement.<init>(PubsubAcknowledgement.java:43) ~[camel-google-pubsub-2.25.0.jar:2.25.0]
   	at org.apache.camel.component.google.pubsub.consumer.ExchangeAckTransaction.<init>(ExchangeAckTransaction.java:30) ~[camel-google-pubsub-2.25.0.jar:2.25.0]
   	at org.apache.camel.component.google.pubsub.GooglePubsubConsumer.<init>(GooglePubsubConsumer.java:52) ~[camel-google-pubsub-2.25.0.jar:2.25.0]
   	at org.apache.camel.component.google.pubsub.GooglePubsubEndpoint.createConsumer(GooglePubsubEndpoint.java:112) ~[camel-google-pubsub-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:69) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:107) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:172) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3954) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3861) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3647) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3488) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3247) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3243) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3266) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3243) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3159) ~[camel-core-2.25.0.jar:2.25.0]
   	at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) ~[camel-spring-2.25.0.jar:2.25.0]
   	at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174) ~[camel-spring-2.25.0.jar:2.25.0]
   	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
   	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
   	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
   	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
   	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
   	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
   	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
   	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
   	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
   	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
   	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
   	at org.cloudwheel.lowell.aptic.orchestrator.ApticOrchestratorKt.main(ApticOrchestrator.kt:13) ~[classes/:na]
   Caused by: java.lang.ClassNotFoundException: com.google.api.client.repackaged.com.google.common.base.Strings
   	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]
   	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
   	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
   	... 35 common frames omitted
   ```
   
   PS: I see there are a couple of references to google Strings util on the master branch as well. If you'd like I can also submit a PR for those.
   
   [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
   [x] Each commit in the pull request should have a meaningful subject line and body.
   [x] If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   [x] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
   Below are the contribution guidelines:
   https://github.com/apache/camel/blob/master/CONTRIBUTING.md
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 413998)
    Remaining Estimate: 0h
            Time Spent: 10m

> Remove unwanted dependency to google-http-client library
> --------------------------------------------------------
>
>                 Key: CAMEL-14292
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14292
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-google-pubsub
>    Affects Versions: 2.24.2
>            Reporter: Matthieu Ricciuti
>            Assignee: Andrea Cosentino
>            Priority: Major
>             Fix For: 2.24.3, 3.0.1, 2.25.0, 3.1.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Current version of this component has an annoying implicit dependency to "_com.google.http-client:google-http-client:1.22.0_" library, due to the following import in [GooglePubsubEndpoint|https://github.com/apache/camel/blob/camel-2.24.x/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpoint.java] class:
> {{ import com.google.api.client.repackaged.com.google.common.base.Strings;}}
> The wrong Strings class is being used ( the one from guava repackaged in  _google-http-client_ library, instead of the expected one from _com.google.guava_ )
> This makes very difficult to use this component as soon as we introduced other google-related libraries that bring newer version of `com.google.api-client:google-api-client` : newer version of this library depend on version '1.28.0' of the 'google-http-client' library which does not repackage guava anymore.
> At runtime we simply get a NoClassDefFoundError:
> java.lang.NoClassDefFoundError: com/google/api/client/repackaged/com/google/common/base/Stringsjava.lang.NoClassDefFoundError: com/google/api/client/repackaged/com/google/common/base/Strings at org.apache.camel.component.google.pubsub.GooglePubsubEndpoint.afterPropertiesSet(GooglePubsubEndpoint.java:87)
>  
> Could you please fix this wrong import to "Strings" class?
> Thanks.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)