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.

VERY strange runtime errors with com.google.common.cache.CacheBuilder

See original GitHub issue

So it would seem that most of the Cassandra java drivers out there are using guava CacheBuilder. I have tried Astayanx and at runtime I get:

Caused by: java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.build()Lcom/google/common/cache/Cache;
    at com.netflix.astyanax.thrift.ThriftKeyspaceImpl.<init>(ThriftKeyspaceImpl.java:116)
    at com.netflix.astyanax.thrift.ThriftFamilyFactory.createKeyspace(ThriftFamilyFactory.java:41)
    at com.netflix.astyanax.AstyanaxContext$Builder.buildKeyspace(AstyanaxContext.java:146)
    at com.disney.tss.auth.backend.persistence.CassandraClient.<init>(CassandraClient.java:28)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
    ... 25 more

I have tried the datastax driver and get a similar error in the same class CacheBuilder:

Caused by: java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.maximumWeight(J)Lcom/google/common/cache/CacheBuilder;
    at com.datastax.driver.core.CodecRegistry.defaultCacheBuilder(CodecRegistry.java:305)
    at com.datastax.driver.core.CodecRegistry.<init>(CodecRegistry.java:297)
    at com.datastax.driver.core.CodecRegistry.<clinit>(CodecRegistry.java:172)
    at com.datastax.driver.core.Configuration$Builder.build(Configuration.java:276)
    at com.datastax.driver.core.Cluster$Builder.getConfiguration(Cluster.java:1221)
    at com.datastax.driver.core.Cluster.<init>(Cluster.java:116)
    at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:181)
    at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:1238)
    at com.disney.tss.auth.backend.persistence.CassandraClient.<init>(CassandraClient.java:31)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
    ... 25 more

When I check my maven includes and look for the “missing” methods, they are there. But evidently google is doing something weird with class loaders or something. More than one product that depends on this class fails inexplicably.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
steowenscommented, Jan 17, 2016

Do you suppose that the maven tomcat7 plugin under which this is executing might be the culprit? Given everything I have observed while digging in to this your suspicion seems very well founded indeed.

0reactions
steowenscommented, Jan 17, 2016

Yes, that did the trick. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask Question - Stack Overflow
A strange run time error when working with JPMML library (with guava). I used the jpmml related dependencies in my pom.xml like below...
Read more >
CacheBuilder (Guava: Google Core Libraries for Java 19.0 API)
A builder of LoadingCache and Cache instances having any combination of the following features: automatic loading of entries into the cache ...
Read more >
Bug? When setting expireAfterWrite, all my keys get evicted ...
I'm using Scala and com.google.guava version 18.0. I'm storing a Future Option, hope it is not the cause of this, and every time...
Read more >
Can't cache this! - LinkedIn
Here is a fragment of code showing how the cache was configured: var cache = CacheBuilder.newBuilder() .refreshAfterWrite(Constants.
Read more >
spotify/scio - Gitter
OK, so I've manged to read nested Json String as TableRow with Google Jackson ... /time/Duration;)Lcom/google/common/cache/CacheBuilder; [error] java.lang.
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