Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchMethodError caused by dependency conflict issue due to multiple versions of com.google.guava:guava:jar #573

Open
LeoAugust19 opened this issue Aug 8, 2018 · 1 comment

Comments

@LeoAugust19
Copy link

Hi, we found multiple versions of com.google.guava:guava:jar exist in org.wisdom-framework:wisdom-test:jar:0.10.0. As shown in the following dependency tree, only com.google.guava:guava:jar:14.0 will be loaded, based on "Maven's nearest wins strategy", and the other versions will be shadowed during the packaging process.

However, method <com.google.common.base.Splitter: java.util.List splitToList(java.lang.CharSequence)> only included in the shadowed version com.google.guava:guava:jar:18.0. As a result, an exception will be thrown with the following stack trace when your project referencing the missing method.

Stack trace

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Splitter.splitToList(Ljava/lang/CharSequence;)Ljava/util/List;
at org.wisdom.maven.osgi.DependencyEmbedder.parse(DependencyEmbedder.java:74)
at org.wisdom.maven.osgi.DependencyEmbedder.(DependencyEmbedder.java:68)
at org.wisdom.maven.osgi.BundlePackager.bundle(BundlePackager.java:84)

Dependency tree

org.wisdom-framework:wisdom-test:jar:0.10.0
+- org.wisdom-framework:wisdom-api:jar:0.10.0:compile
| +- com.google.guava:guava:jar:14.0:compile
| - javax.validation:validation-api:jar:1.1.0.Final:compile
+- org.wisdom-framework:wisdom-maven-plugin:jar:0.10.0:compile
| +- (org.apache.felix:org.apache.felix.ipojo.annotations:jar:1.12.1:compile - omitted for duplicate)
| +- com.google.javascript:closure-compiler:jar:v20150126:compile
| | +- com.google.javascript:closure-compiler-externs:jar:v20150126:compile
| | +- args4j:args4j:jar:2.0.26:compile
| | +- (com.google.guava:guava:jar:14.0:compile - version managed from 18.0; omitted for duplicate)
| | - com.google.truth:truth:jar:0.24:compile
| | +- (com.google.guava:guava:jar:14.0:compile - version managed from 17.0; omitted for duplicate)
| | - (junit:junit:jar:4.12:test - version managed from 4.10; scope managed from compile; omitted for duplicate)
| +- org.apache.maven:maven-plugin-api:jar:3.2.1:compile
| | +- (org.apache.maven:maven-model:jar:3.2.1:compile - omitted for conflict with 3.0)
| | +- (org.apache.maven:maven-artifact:jar:3.2.1:compile - omitted for duplicate)
| | - org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M5:compile
| | +- javax.enterprise:cdi-api:jar:1.0:compile
| | | +- javax.annotation:jsr250-api:jar:1.0:compile
| | | - (javax.inject:javax.inject:jar:1:compile - omitted for duplicate)
| | +- (com.google.guava:guava:jar:14.0:compile - version managed from 10.0.1; omitted for duplicate)
| | - (org.codehaus.plexus:plexus-utils:jar:2.1:compile - omitted for conflict with 3.0.20)
| +- (com.google.guava:guava:jar:14.0:compile - version managed from 19.0; omitted for duplicate)
| - (org.ow2.chameleon.testing:osgi-helpers:jar:0.6.2:compile - omitted for duplicate)
+- org.ow2.chameleon:chameleon-core:jar:1.10.9:compile
| +- org.apache.felix:org.apache.felix.framework:jar:5.4.0:compile
| +- (com.google.guava:guava:jar:14.0:compile - version managed from 19.0; omitted for duplicate)
| +- (commons-io:commons-io:jar:2.4:compile - version managed from 1.3.2; omitted for duplicate)
| - org.fusesource.jansi:jansi:jar:1.11:compile
- org.seleniumhq.selenium:selenium-java:jar:2.48.2:compile
+- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.48.2:compile
| - org.seleniumhq.selenium:selenium-remote-driver:jar:2.48.2:compile
| +- cglib:cglib-nodep:jar:2.1_3:compile
| +- (com.google.code.gson:gson:jar:2.3.1:compile - omitted for conflict with 2.2.4)
| +- org.seleniumhq.selenium:selenium-api:jar:2.48.2:compile
| | +- (com.google.guava:guava:jar:14.0:compile - version managed from 18.0; omitted for duplicate)
| | +- (com.google.code.gson:gson:jar:2.3.1:compile - omitted for conflict with 2.2.4)
| | - (org.apache.httpcomponents:httpclient:jar:4.5.1:compile - omitted for duplicate)
| +- (org.apache.httpcomponents:httpclient:jar:4.5.1:compile - omitted for duplicate)
| +- (com.google.guava:guava:jar:14.0:compile - version managed from 18.0; omitted for duplicate)
- org.seleniumhq.selenium:selenium-leg-rc:jar:2.48.2:compile
- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.48.2:compile - omitted for duplicate)

Solution
Upgrade com.google.guava:guava:jar to 18.0.

Thanks a lot!
Regards,
Leo

@cescoffier
Copy link
Member

Hello, I believe that updating to latest guava and updating the code to use the new API is the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants