question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoSuchMethodError for Preconditions.checkState after upgrading Gradle plugin from 5.2.3 to 6.5.1

See original GitHub issue

I have upgraded from 5.2.3 to 6.5.1 of the Gradle plugin. I get hundreds of exceptions like the following from various resources (JAR, JS, POM.XML, etc.) after upgrading.

2021-12-29T16:31:31.953+0100 [DEBUG] [org.owasp.dependencycheck.AnalysisTask] Begin Analysis of '/var/folders/6y/1lytq4cs2_z1p55zt1y4dr5w0000gn/T/dctemp499e908b-0e0a-4e57-aee0-ddf515bd0f36/check6941924799983090101tmp/762/foo.js' (Sonatype OSS Index Analyzer)
2021-12-29T16:31:31.953+0100 [DEBUG] [org.owasp.dependencycheck.analyzer.OssIndexAnalyzer] Requesting component-reports for 241 dependencies
2021-12-29T16:31:31.954+0100 [DEBUG] [org.owasp.dependencycheck.utils.Settings] Settings.getDataFile() - file: '/Users/XYZ/.gradle/dependency-check-data/5.0'
2021-12-29T16:31:31.954+0100 [DEBUG] [org.owasp.dependencycheck.data.ossindex.OssindexClientFactory] OSS Index Cache: org.sonatype.ossindex.service.client.cache.DirectoryCache$Configuration@6090d4d5
2021-12-29T16:31:31.954+0100 [DEBUG] [org.sonatype.ossindex.service.client.transport.UserAgentSupplier] User-agent: dependency-check/6.5.1 (Mac OS X; 10.15.7; x86_64; 11.0.13)
2021-12-29T16:31:31.954+0100 [DEBUG] [org.sonatype.ossindex.service.client.internal.OssindexClientImpl] Transport: org.owasp.dependencycheck.data.ossindex.ODCConnectionTransport@6bd3010c
2021-12-29T16:31:31.954+0100 [DEBUG] [org.sonatype.ossindex.service.client.internal.OssindexClientImpl] Marshaller: org.sonatype.ossindex.service.client.marshal.GsonMarshaller@1fc21133
2021-12-29T16:31:31.954+0100 [DEBUG] [org.sonatype.ossindex.service.client.internal.OssindexClientImpl] Base URL: https://ossindex.sonatype.org/
2021-12-29T16:31:31.954+0100 [DEBUG] [org.sonatype.ossindex.service.client.internal.OssindexClientImpl] Batch size: 128
2021-12-29T16:31:31.954+0100 [WARN] [org.owasp.dependencycheck.AnalysisTask] An unexpected error occurred during analysis of '/var/folders/6y/1lytq4cs2_z1p55zt1y4dr5w0000gn/T/dctemp499e908b-0e0a-4e57-aee0-ddf515bd0f36/check6941924799983090101tmp/762/foo.js' (Sonatype OSS Index Analyzer): 'void com.google.common.base.Preconditions.checkState(boolean, java.lang.String, java.lang.Object)'
2021-12-29T16:31:31.954+0100 [ERROR] [org.owasp.dependencycheck.AnalysisTask]
java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkState(boolean, java.lang.String, java.lang.Object)'
       at org.sonatype.ossindex.service.client.cache.DirectoryCache.<init>(DirectoryCache.java:84)
       at org.sonatype.ossindex.service.client.cache.DirectoryCache$Configuration.create(DirectoryCache.java:328)
       at org.sonatype.ossindex.service.client.internal.OssindexClientImpl.<init>(OssindexClientImpl.java:96)
       at org.owasp.dependencycheck.data.ossindex.OssindexClientFactory.create(OssindexClientFactory.java:122)
       at org.owasp.dependencycheck.analyzer.OssIndexAnalyzer.requestReports(OssIndexAnalyzer.java:210)
       at org.owasp.dependencycheck.analyzer.OssIndexAnalyzer.analyzeDependency(OssIndexAnalyzer.java:140)
       at org.owasp.dependencycheck.analyzer.AbstractAnalyzer.analyze(AbstractAnalyzer.java:131)
       at org.owasp.dependencycheck.AnalysisTask.call(AnalysisTask.java:88)
       at org.owasp.dependencycheck.AnalysisTask.call(AnalysisTask.java:37)
       at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
       at java.base/java.lang.Thread.run(Thread.java:829)

I have run gradle dependencyCheckPurge and removed ~/.gradle/dependency-check-data/*. Still, I get the above exceptions. Is there something I can try to fix this issue?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aikebahcommented, Dec 30, 2021

For the debugger: evaluate in the debugger

com.google.common.base.Preconditions.class.getResource("Preconditions.class").toString()

(that is: make the classloader of Preconditions.class lookup the class file as a resource and then print its full path)

Should yield a jar:-url that tells from which jar-file the class is loaded

0reactions
travisspencercommented, Dec 30, 2021

Never mind. That closure compiler seemed to have been added to the build script’s class path when org.owasp:dependency-check-gradle:4.0.2 was added. Clearly not needed anymore. Thanks, @aikebah for all the help in sorting this out!

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NoSuchMethodError: com.google.common.base ...
The app builds ok, but then when I Make Project I get this error. ... Realm classpath "io.realm:realm-gradle-plugin:3.0.0" //GCM classpath ...
Read more >
Upgrading your build from Gradle 5.x to 6.0
The previous step will help you identify potential problems by issuing deprecation warnings when a plugin does try to use a deprecated part...
Read more >
Upgrading your build from Gradle 6.x to the latest
The previous step will help you identify potential problems by issuing deprecation warnings when a plugin does try to use a deprecated part...
Read more >
Installing Gradle - Gradle User Manual
When upgrading to a different version of Gradle, just change the GRADLE_HOME environment variable. ↓ Proceed to next steps. Verifying installation. Open a ......
Read more >
Upgrading your build from Gradle 4.x to 5.0
If you are using Gradle for Android, you need to move to version 3.3 or higher of both the Android Gradle Plugin and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found