Questions tagged [guava]
Google's Core Java Library for Java and Android development.
3,539
questions
0
votes
0
answers
30
views
How can i add an library into my project repository on github?
Sorry for bad english. I made an java code and created a repository on github, but the library guava that i was using didnt go with the rest of the code. How can i add this library in my repository in ...
1
vote
0
answers
52
views
Java Map with Multimap values - how to efficient split the true entries from the false ones
I have a Map made up of this structure Map<String, Multimap<Boolean, String>> . I want to separate all the true entries in one new map and the false ones in a second. I have the following (...
0
votes
1
answer
54
views
Guava cache, one to many key-values
This is my first time posting a question here,and I'm new to Guava Cache, so please bare with me :).
Regarding the cache keys - In the DB itself the relation between my key to the values I'm ...
-1
votes
0
answers
20
views
Why I have zip file closed error with log4j log appender, guice and guava (guava is relocated) when I use minecraft plugin?
I have relocated guava and included it into fat jar. Guice is located in external jar where guava is relocated too. Main jar is java minecraft plugin in paper core 1.16.5 server.
https://paste.gg/p/...
0
votes
0
answers
24
views
Is possible to construct a com.google.common.collect.Table from an existing map?
Suppose I have an existing Map<Integer, Map<Integer, String>> which contains items, I want to construct a com.google.common.collect.Table from that map for there's unnecessary data copy
0
votes
0
answers
19
views
Jackson serializes empty guava table as {"empty": true} instead of {}
I'm trying to serialize and deserialize an empty guava Table<R, C, V> object. The behavior I would expect is something like "table": {}, but what I'm getting is "table": {&...
0
votes
0
answers
42
views
Guava cache eviction before expireAfterWrite and before max size is reached
I'm using Guava cache as non-loading cache in my project and set the max size and expire after write
CacheBuilder.newBuilder()
.expireAfterWrite(1h)
.maximumSize(5000)
.recordStats()
I ...
2
votes
2
answers
121
views
Peeking into an iterator
Is there a way in Kotlin to "peek" into the next element of an iterator without advancing it? For an example use case, consider this function for merging two pre-sorted sequences:
fun merge(...
0
votes
2
answers
45
views
Best way to adapt Guava's AbstractExecutorService to achieve (gRPC) context propagation?
I had hoped to find a simple class that just does this in gRPC Context library, but sadly no luck. I want to wrap an arbitrary ExecutorService so it will wrap its tasks in order to propagate the ...
0
votes
0
answers
34
views
Cannot init webdriver in jenkins server after upgrade selenium to v4.11.0
After upgrade to selenium v4.11.0 I cannot init webdriver in jenkins server, it throws out with message java.lang.NoSuchMethodError but I'm still able to run on local with the same code, same JDK, any ...
0
votes
0
answers
384
views
Could not resolve com.google.guava:guava:31.1.-jre
I am trying to download the dependency serenity core 4xx version(testImplementation "net.serenity-bdd:serenity-core:4.0.0-beta-1") but its throwing the below error:
could not resolve com....
0
votes
1
answer
117
views
Xamarin Forms error with android 13: "Java.Lang.NoClassDefFoundError" Failed resolution of: Landroidx/concurrent/futures/AbstractResolvableFuture
This might save someone a little bit of time.
After updating Xamarin Forms to the latest version (5.0.) and the android project to the new aim version 13 (a lot of errors might be gone, just because ...
5
votes
2
answers
2k
views
How can I make Gradle pick the right guava variant?
I'm trying to use the OpenRewrite plugin in my Java project and it requires guava.
Gradle is unable to choose between two variants because the plugin doesn't check attribute org.gradle.jvm.environment....
1
vote
2
answers
138
views
Why is JSON serialization different in test than it is in main when using Spring Boot?
I am noticing that out of the box JSON serialization does not work the same in production vs. unit tests. Things that work perfectly fine when I run the app with ./gradlew bootRun fail in unit tests. ...
0
votes
1
answer
350
views
Getting java.lang.NoClassDefFoundError for class io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder
I am running a jar on spark slave with version spark-2.5.6-bin-hadoop where i am getting this error on submitting the jar
Exception occurred while create new JwtSource
java.lang.NoClassDefFoundError: ...
0
votes
0
answers
28
views
Graph - How to use topological sort to execute dependency tasks [duplicate]
I have a usecase where I have jobs which can have dependencies or be boxes containing other jobs like in autosys.
For e.g JOB_BOX contains JOB1, JOB2 and JOB3 where JOB2 depends on JOB1 and JOB3 ...
2
votes
0
answers
47
views
How to build a guava LoadingCache with case insensitive String keys
I'm looking to make use of a guava loading cache, defined so far as follows. I would like the keys used as a string to be case insensitive. Ideally, I would prefer the cache to handle this, rather ...
-1
votes
1
answer
62
views
Guava issue when starting Asterisk-Java
I'm trying to compile a project and it uses guava. The project is Asterisk-Java (https://github.com/asterisk-java/asterisk-java) and when I'm trying to run the .jar with the command java -cp asterisk-...
0
votes
0
answers
96
views
What is the right way to call com.google.common.collect.Lists.cartesianProduct()?
I am trying to call com.google.common.collect.Lists.cartesianProduct(...), but I keep getting a NoSuchMethodError. I would happily use either the version that expects a List of Lists as an argument or ...
0
votes
0
answers
94
views
Caffeine cache secondary indexing equivalent options
I am using caffeine cache and base use case is simple key value lookup based on primary key of objects however the values are objects and can be looked in in multiple ways and often resulting a list, ...
0
votes
0
answers
149
views
How to write unit test for Guava rate Limiter applied on a methods
I am trying to write unit test for RateLimiter using guava.
Below is my service class where I have added RateLimiter. I wanted to rate Limit method-xyzMethod present in service class. I have made qps/...
0
votes
1
answer
57
views
Sort list based on comparator defined on another list using Guava Ordering
I've two lists of same size : List<A>listA, List<B>listB that are completely independent of each other.
I'd like to sort listA based on how the elements move in listB.
Assume there's an ...
0
votes
0
answers
18
views
Compare more than 2 json file for common properties - Java [duplicate]
I have a list of json property files ( around 20 json property files)
Now, need is to find common properties across these json files.
I have used guava api json file comparison, it compares 2 json ...
0
votes
1
answer
663
views
pom.xml file is showing these yellow color warnings in IntelliJIDEA while I can run the project just fine
I am using Appium 2.0.0-beta66, Java Client 8.5.0, node 18.xx, Selenium-java 4.9.1, Selenium Server 3.141.59, TestNG 7.7.1, and JDK 1.15.0-02, what is the next long term JDK I can go for ?
BTW, I am ...
0
votes
1
answer
73
views
FIrebase - java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.exhaust(Ljava/io/InputStream;)J
i'm working on a feature using google firebase cloud messaging to send notifications. It's a eclipse JEE java project using maven and ear deployment. I'm getting troubles trying to fetch my acces ...
0
votes
0
answers
30
views
Force Glassfish4 to use Guava from ear
I have a maven project with an EJB and a war. For my use case, I have to use minIO which uses guava-30.1.1-jre.
I am using GlassFish version 4 and inside the modules of GlassFish, an older version of ...
0
votes
1
answer
65
views
Does the class (of the cached-value) needs to implement Serializable in Google Guava Cache?
I am using Google Guava Cache to store class of type let's say LevelOneDTO. Now this class is extending from LevelTwoDTO, which in turn extends from 2 more levels.
When I use a Google Guava Cache ...
0
votes
0
answers
21
views
Same Guava rateLimiter not able to work with multiple methods
I am trying to implemt RateLimiter using guava.
Below is my class where I have added RateLimiter. I wanted to rate Limit method-xyzMethod present in service class. I have made qps/tps as 3 for ...
0
votes
2
answers
116
views
ListenableFuture: Not sure how to handle insert method's return type
From the documentation from Google:
// Returns the number of users inserted.
@Insert(onConflict = OnConflictStrategy.REPLACE)
public ListenableFuture<Integer> insertUsers(List<User> users);...
0
votes
1
answer
58
views
Guava Cache Access From Different Classes
Is it possible to access the guava cache from any of the class within that project?
Suppose if I create class cache bannelUrl within FetchBanner.java, can the values from bannelUrl from any other ...
0
votes
1
answer
304
views
Guava cache with async loading for non-blocking get
I'm trying to use Guava cache with async loading of values and have non-blocking get(). Because I do load values from DB so it is pretty expensive, it would be OK to serve temporally out-dated data ...
2
votes
1
answer
135
views
How can I use Guava's immutable collections with mybatis?
I tried making return type ImmutableList and selecting a bunch of IDs from a table, but of course mybatis does not know how to do that and throws exception:
org.apache.ibatis.reflection....
0
votes
0
answers
15
views
Using Guava classes in an Eclipse project
In my Eclipse project, I need Matplotlib4j, which in turn needs Guava, which seems to be an Eclipse plugin. For example, in com.github.shOnk.matplotlib4j, there is import com.google.common.base....
0
votes
1
answer
407
views
Pros and cons of using Guava RateLimiter vs resilience4j ratelimiter
We are thinking of implementing a rate limiter in one of our java based services. Wanted to understand the pros and cons of using Guava ratelimiter vs resilience4j ratelimiter.
Haven't worked on them ...
0
votes
0
answers
22
views
! Caused by: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V
I wrote an api to fetch gcs bucket size using stackdriver metrics. However, it is throwing error ! Caused by: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/...
0
votes
1
answer
122
views
Predicates of guava has gone obselete in SwaggerConfig file after springfox updated to 3.0.0, How to resolve?
This is my SwaggerConfig file. Predicates used from "com.google.common.base.Predicates" has gone obselete after updation of springfox to 3.0.0
@EnableSwagger2
@Configuration
public class ...
0
votes
1
answer
12
views
Using AssertSame to validate instance of client from CacheBuilder
Question on CacheBuilder maybe someone can help with:
I have a Cache defined as such:
private final Cache<String, ServiceClient> SERVICE_CLIENT_CACHE = CacheBuilder.newBuilder()
....
0
votes
0
answers
86
views
Equivalent python code for java code (using guava hash lib)
I have java code here:
import com.google.common.base.CharMatcher;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
import java.util.Base64;
public final class ...
0
votes
1
answer
216
views
Guava's Rate Limiter - change rate at which permits are issued
i want to implement a throttle mechanism in spring boot for all our application requests
i've chosen to catch all http requests in the OncePerRequestFilter and use the guava rate-limiter with 3 cases
...
2
votes
1
answer
86
views
How to use Guava Cache with secondary index key?
Whenever we look to retrieve data from multiple keys, we choose to lean over databases. I have a Class Cart as shown:
@Data
public class Cart {
private String cartId;
private String ...
0
votes
1
answer
234
views
How do I fix a dependency conflict with guava ListenableFuture when building an Expo app with eas?
I am building an Expo app using eas which makes use of the react-native-usb-serialport library. When building this library I get the following error:
[stderr]
* What went wrong:
[stderr]
Execution ...
0
votes
0
answers
14
views
Guava cache refresh in a live service
I am using Guava Cache in one of my services. My service needs to refresh the cache periodically with a frequency of once a day. What is the best practice to refresh the cache? Also if we do this ...
0
votes
1
answer
644
views
Getting NoSuchMethodError for com.google.common.collect.ImmutableMap.of when running Selenium
When I attempt to run the following code:
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
I receive the following error:
java.lang.NoSuchMethodError: com.google.common.collect....
0
votes
0
answers
47
views
Strictly enforcing a dependency version is required to fix a crash, but causes unit-test dependency conflicts. How to solve?
So in order to fix a pesky crash I was getting in production on Android 6 devices, I was forced to strictly use the android version of guava in gradle.
The crash in question is described here if ...
0
votes
0
answers
217
views
Could not load [com.google.common.util.concurrent.AbstractFuture$Failure$1]
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.google.common.util.concurrent.AbstractFuture$Failure$1]. The ...
1
vote
0
answers
162
views
How to resolve sonar guava issue?
Could you please tell me how to resolve the following sonar issues.
guava-31.1-android.jar | Reference: CVE-2020-8908 | CVSS Score: 6.2 | Category: CWE-379 | guava - Creation of Temporary File in ...
-1
votes
1
answer
664
views
javax.annotations split package using jaxrs-api and guava in Java 17
I inherited a java project which won't build. I'm trying to migrate to java 17 and have encountered what I believe is called a "split package".
I have several dependencies that requires org....
0
votes
0
answers
143
views
Google Guava getTopLevelClassesRecursive not finding classes when running, only during test
I am using OpenJDK 17 and Guava 31.1-Jre. I am also using Spring Boot.
I have the line:
ImmutableSet<ClassPath.ClassInfo> classSet = ClassPath.from(ClassLoader.getSystemClassLoader())
...
0
votes
0
answers
73
views
how to let jackson deserialize guava multimap using the '@class' field inside json to deside the target class?
I have a json like this:
{
'@class':'A',
'aProperty':{
'@class': 'com.google.common.collect.ArrayListMultimap',
'a':[1,2,3],
'b':[22]
}
}
and the class A like this:
class A{
...
0
votes
0
answers
102
views
LoadingCache: "InvalidCacheLoadException: loadAll failed to return a value for" thrown for every key passed to cache.getAll(ids)
I'm using LoadinCache to cache the data I get from database. For my use case I needed to use getAll() and loadAll() since I was making bulk calls to database with list of ids and store it in cache.
My ...