java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.expireAfterWrite(Ljava/time/Duration;)
See original GitHub issueCacheBuilder.newBuilder()
.expireAfterWrite(Duration.ofHours(1))
public CacheBuilder<K, V> expireAfterWrite(long duration, TimeUnit unit) {
checkState(
expireAfterWriteNanos == UNSET_INT,
"expireAfterWrite was already set to %s ns",
expireAfterWriteNanos);
checkArgument(duration >= 0, "duration cannot be negative: %s %s", duration, unit);
this.expireAfterWriteNanos = unit.toNanos(duration);
return this;
}
Relevant Stackoverflow link which explains the issue: https://stackoverflow.com/questions/61810399/execute-google-cloud-dataflow-pipeline-from-spring-controller
To summarise, the method requires an additional parameter TimeUnit unit
, which is not specified in the caller. I could not find any overloaded method which just has one parameter.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
com.google.common.cache.CacheBuilder.maximumSize(J ...
java.lang.NoSuchMethodError is thrown at runtime because the JVM does not find the method in the referenced class.
Read more >spotify/scio - Gitter
[error] (run-main-8) java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.expireAfterWrite(Ljava/time/Duration ...
Read more >com.google.common.cache Class CacheBuilder<K,V> - Guava
A builder of LoadingCache and Cache instances having any combination of the ... from the cache when any of maximumSize, maximumWeight, expireAfterWrite, ...
Read more >com/google/common/cache/CacheBuilder
In the last weeks, we had to add guava as a dependency to avoid. java.lang.NoClassDefFoundError: com/google/common/cache/CacheBuilder. at hudson.model.
Read more >[jira] [Comment Edited] (BEAM-9542) Where the ...
CacheBuilder.expireAfterWrite(Ljava/time/Duration;)Lcom/google/common/cache/CacheBuilder; java.lang.NoSuchMethodError: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fixed it with this,
It is a Spring Boot application with dependencies specified in
build.gradle
file. GCSIO is being used by Apache Beam. The versions I am using are specified here below:I was able to resolve this issue by adding guava version
29-0-jre
tobuild.gradle
file: