You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
org.springframework.data.redis.core.BoundValueOperations referenced from a method is not visible from class loader: 'app'
When I ran the following code inside the Docker container, an error occurred I am unable to reproduce this issue when running in a local environment I don't know what caused this problem
@SpringBootApplication
public class CaffeineDemoApplication implements CommandLineRunner {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Override
public void run(String... args) throws Exception {
LoadingCache<String, String> cache = Caffeine.newBuilder()
.refreshAfterWrite(Duration.ofSeconds(5))
.build(key -> {
// do something
// ...
stringRedisTemplate.boundValueOps(key).set("1");
// ...
return "any";
});
cache.get("1");
// error
// java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: org.springframework.data.redis.core.BoundValueOperations referenced from a method is not visible from class loader: 'app'
cache.refresh("1");
}
public static void main(String[] args) {
SpringApplication.run(CaffeineDemoApplication.class, args);
}
}
mp911de
changed the title
BoundValueOperations referenced from a method is not visible from class loader: 'app'BoundValueOperations not visible when initializing boundValueOps on Fork/Join pool
May 31, 2024
Thanks for the report. The issue is caused by Spring Data Redis relying on the contextual class loader. Running code on the Fork/Join pool resorts to the app class loader that was used to bootstrap the Spring Boot loader. Spring Boot uses a different class loader that has access to the bundled jars and so class loading fails.
environment:
Describe the bug:
When I ran the following code inside the Docker container, an error occurred I am unable to reproduce this issue when running in a local environment I don't know what caused this problem
To Reproduce:
demo.zip
The text was updated successfully, but these errors were encountered: