Home  >  Forum  >  NoSQL
Post New Query

Caused by: java.lang.ClassNotFoundException: redis.clients.jedis.JedisPoolConfig



Asked on August 09, 2018
Hi, I am creating Spring Boot Redis Application. Find my Maven dependencies.

 <dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-data-redis</artifactId>
   <version>2.0.4.RELEASE</version>
 </dependency>   

But it is not resolving JedisPoolConfig. I am getting error.


Caused by: java.lang.NoClassDefFoundError: redis/clients/jedis/JedisPoolConfig
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3139)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2266)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:641)
... 78 more
Caused by: java.lang.ClassNotFoundException: redis.clients.jedis.JedisPoolConfig
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1138)
... 82 more


How to fix it?



Replied on August 09, 2018
JedisPoolConfig is needed when we use Jedis Configuration. In Spring Boot 2.0, spring-boot-starter-data-redis gives Lettuce dependency by default instead of Jedis. To use Jedis configuration, exclude Lettuce and add Jedis as following.

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-redis</artifactId>
  <exclusions>
    <exclusion>
     <groupId>io.lettuce</groupId>
     <artifactId>lettuce-core</artifactId>
    </exclusion>
  </exclusions>           
</dependency>       
<dependency>
  <groupId>redis.clients</groupId>
  <artifactId>jedis</artifactId>
</dependency>




Replied on August 09, 2018
Thanks. It is working.

Write Answer








©2019 concretepage.com | Privacy Policy | Contact Us