我是靠谱客的博主 斯文吐司,最近开发中收集的这篇文章主要介绍SpringBoot 引入Jedis 报错:java.lang.ClassNotFoundException: redis.clients.util.SafeEncoder,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

参考:https://blog.csdn.net/taotao_guiwang/article/details/102519951

参考:https://blog.csdn.net/doubleqinyan/article/details/102688467

 

运行提示报错

Caused by: java.lang.NoClassDefFoundError: redis/clients/util/SafeEncoder
	at org.springframework.data.redis.connection.jedis.JedisConverters.lambda$static$1(JedisConverters.java:127)
	at org.springframework.data.redis.connection.jedis.JedisConverters.toBytes(JedisConverters.java:342)
	at org.springframework.data.redis.connection.jedis.JedisConverters.<clinit>(JedisConverters.java:134)
	at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.<clinit>(JedisConnectionFactory.java:86)
	at com.dongriaf.framework.config.redis.RedisConfig.redisConnectionFactory(RedisConfig.java:80)
	at com.dongriaf.framework.config.redis.RedisConfig$$EnhancerBySpringCGLIB$$586d20c4.CGLIB$redisConnectionFactory$4(<generated>)
	at com.dongriaf.framework.config.redis.RedisConfig$$EnhancerBySpringCGLIB$$586d20c4$$FastClassBySpringCGLIB$$cc5a24ea.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
	at com.dongriaf.framework.config.redis.RedisConfig$$EnhancerBySpringCGLIB$$586d20c4.redisConnectionFactory(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	... 113 common frames omitted
Caused by: java.lang.ClassNotFoundException: redis.clients.util.SafeEncoder
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 128 common frames omitted

 

把jedis的版本降低成2.9.1即可,3.1.0版本中没有redis.clients.util.SafeEncoder的类定义

改动前:

    <dependency>
       <groupId>redis.clients</groupId>
       <artifactId>jedis</artifactId>
       <version>3.1.0</version>
    </dependency>

改动后:

   <dependency>
       <groupId>redis.clients</groupId>
       <artifactId>jedis</artifactId>
       <version>2.9.1</version>
   </dependency>

 

最后

以上就是斯文吐司为你收集整理的SpringBoot 引入Jedis 报错:java.lang.ClassNotFoundException: redis.clients.util.SafeEncoder的全部内容,希望文章能够帮你解决SpringBoot 引入Jedis 报错:java.lang.ClassNotFoundException: redis.clients.util.SafeEncoder所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部