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.

java.lang.NoClassDefFoundError: StorageOptions

See original GitHub issue

Been recently dealing with issues regarding Guava versions within Hadoop and the rest used by other components.

After getting rid of the MethodNotFound errors regarding Preconditions I’ve came to another exception which I can’t really understand as the library is provided within the sbt file…

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/cloud/storage/StorageOptions

Taking into account this libraries and versioning.

val googleCloudV    = "1.89.0"
val googleHadoopV   = "hadoop3-2.0.0"

val cloudStorage = "com.google.cloud"            % "google-cloud-storage" % googleCloudV
val cloudHadoop  = "com.google.cloud.bigdataoss" % "gcs-connector"        % googleHadoopV

I’ve also tried setting cloudStorage as "provided" but I’m getting, in that case, the same exception regarding Guava.

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V

I’ve already included shadowing to avoid conflict with Hadoop dependencies.

assemblyShadeRules in assembly := Seq(ShadeRule.rename("com.google.**" -> "shadeio.@1").inAll)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
pmakanicommented, Nov 4, 2019

@turboT4 I tried your depenedencies and made small changes in your config, it’s work for me. Could you try below sbt config ?

val googleCloudV = "1.89.0"
val googleHadoopV = "hadoop3-2.0.0"

libraryDependencies += "com.google.cloud.bigdataoss" % "gcs-connector" % googleHadoopV
libraryDependencies += "com.google.cloud" % "google-cloud-storage" % googleCloudV

dependencyOverrides := Seq(
  "com.google.guava" % "guava" % "28.0-jre"
)
assemblyShadeRules in assembly := Seq(
  ShadeRule
    .rename("com.google.*.**" -> "shade.com.google.shade@1.shade@2")
    .inAll
)
0reactions
turboT4commented, Nov 7, 2019

Absolutely @pmakani , here it goes. I also had AWS SDK dependencies (together with their Hadoop, but clean it up for sake of clarity, because without those dependencies it still raises the error, even after removing cache and all related files).

EDIT: Just pasting the sbt and saw my own mistake… Shadowing was being applied outter the module I wanted it to be done so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding google-cloud-storage to maven - NoClassDefFoundError
java.lang.NoClassDefFoundError: com/google/cloud/http/CensusHttpModule at ... getStorageRpcV1(StorageOptions.java:120).
Read more >
How to solve java.lang.NoClassDefFoundError: com/google ...
In this tutorial, we help you how to solve the error "java.lang.NoClassDefFoundError: com/google/cloud/http/HttpTransportOptions"
Read more >
java.lang.NoClassDefFoundError: com/google/api/services ...
Uncaught exception from servlet java.lang.NoClassDefFoundError: com/google/api/services/servicemanagement/ServiceManagement$Builder.
Read more >
com.google.cloud.storage.StorageOptions java code examples
Best Java code snippets using com.google.cloud.storage.StorageOptions (Showing top 20 results out of 315). Refine search Refine arrow. StorageException.
Read more >
spring-cloud-gcp/Lobby - Gitter
... got to be due to downstream dependencies getting upgraded: "Caused by: java.lang.ClassNotFoundException: brave. ... Storage storage = StorageOptions.
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