2
回答
关于Jfinal的redis插件JedisConnectionException: Could not get a resource from the pool
终于搞明白,存储TCO原来是这样算的>>>   

@JFinal 你好,想跟你请教个问题:就是final整合redisa插件的时候,出现了JedisConnectionException: Could not get a resource from the pool出错。流程是这样子的,我在Linux服务器上安装了redis,修改密码,启动服务,然后jfinal 连接

public static void main(String[] args) {
        RedisPlugin rp = new RedisPlugin("userCache", "主机host", 6379, "redis");
        rp.start();

        Cache userCache = Redis.use("userCache");
        userCache.setex("phone", 20, "123455");
        System.out.println(userCache);
    }



主机host就没贴上去了,然后就出现这个问题

Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
	at redis.clients.util.Pool.getResource(Pool.java:53)
	at redis.clients.jedis.JedisPool.getResource(JedisPool.java:99)
	at com.jfinal.plugin.redis.Cache.getJedis(Cache.java:1253)
	at com.jfinal.plugin.redis.Cache.setex(Cache.java:76)
	at com.xhuabu.kilimanjaro.utils.StringUtils.main(StringUtils.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused



请问下是Linux的Redis还需要进行某些设置吗?还是在代码里面需要进行设置?(redis初步接触)



举报
小琪小小
发帖于1年前 2回/1K+阅
顶部