I am building an application with Spring Boot using Redis (with redisson).
When I run my application in development mode, it works fine, but when I try to run it in docker containers, it fails with the error
java.lang.ClassNotFoundException:org.springframework.data.redis.connection.ReactiveStreamCommands
My maven configuration for Redis :
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><dependency><groupId>org.redisson</groupId><!-- for Spring Data Redis v.2.2.x --><artifactId>redisson-spring-data-22</artifactId><version>3.12.2</version></dependency>
My maven configuration to build docker container :
<plugin><groupId>com.spotify</groupId><artifactId>docker-maven-plugin</artifactId><version>1.2.1</version><dependencies><dependency><groupId>javax.activation</groupId><artifactId>activation</artifactId><version>1.1.1</version></dependency></dependencies><configuration><imageName>${imageName}</imageName><!-- default properties to tag an image --><image>${imageName}</image><newName>${imageName}:${tagName}</newName><!-- gitlab registry --><serverId>gitlab-repository</serverId><registryUrl>my.repository</registryUrl><baseImage>adoptopenjdk/openjdk11-openj9:latest</baseImage><entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint><!-- copy the service's jar file from target into the root directory of the image --><resources><resource><targetPath>/</targetPath><directory>${project.build.directory}</directory><include>${project.build.finalName}.jar</include></resource></resources></configuration></plugin>
When I login to my container and analysie my jar libraries (with the following command):
jar -tf my-app.jar | grep redis
I find this :
BOOT-INF/lib/spring-boot-starter-data-redis-2.1.3.RELEASE.jarBOOT-INF/lib/spring-data-redis-2.1.5.RELEASE.jarBOOT-INF/lib/redisson-spring-data-22-3.12.2.jarBOOT-INF/lib/redisson-3.12.2.jar
Which is exactly the same as I get with my jar for development.
Here is the docker-compose extract on how I launch redis :
redis: image: redis:5.0 ports: - 6379:6379 networks: - network volumes: - redis:/data entrypoint: redis-server --appendonly yes restart: unless-stopped
Any clue on what is missing for my container to run properly?Any idea why the spring-data-redis used in the jar is 2.1.5 and not 2.2.x ?Thanks in advance