Skip to content

BoundValueOperations not visible when initializing boundValueOps on Fork/Join pool #2920

Closed
@app2smile

Description

@app2smile

environment:

jdk21
spring boot 3.2.6
caffeine

Describe the bug:

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);
    }
}

To Reproduce:

  1. modify the Redis configuration in application.yml
  2. maven install
  3. docker build -t demo:v1 .
  4. docker run --rm --net=host demo:v1

demo.zip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions