无法运行 Jedis 示例:JedisConnection异常:无法从池中获取资源



我正在尝试来自https://github.com/xetorthio/jedis/wiki/Getting-started但我得到了以下错误:

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:42)
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused

我在OSX 10.9.2上用Jedis-2.4.2,commons-pool-2.0 尝试这个

也遇到了同样的问题。所有的在线教程都显示只是运行一些简单的Java,但你需要在你的计算机上运行redis服务器(duh…)。作为一个新手,我以为这一切都在罐子里,但事实并非如此。它是一个数据库,就像Mongo或其他什么。试试这个:

redis下载

下载后,将其解压缩到UserApps文件夹(在windows上),然后运行redis-server.exe。会弹出一个窗口,其中包含端口等。然后运行java。巴姆,工作起来很有魅力!

您将收到此消息,因为您没有运行redis,或者您试图在错误的主机/端口上连接到它。

我刚刚通过从下载Redis安装程序解决了这个问题https://github.com/MSOpenTech/redis/releases只需简单安装即可。它更简单,建议在Redis下载页面上查看。

最新的稳定版本是2.8.2104

代码对我来说很好:在localhost:6379 上安装和启动redis服务器

  • 安装
$wgethttp://redis.googlecode.com/files/redis-2.2.12.tar.gz$tar xzf redis-2.2.12.tar.gz再贴现-2.212加元$make$make安装
  • 启动

$/usr/local/bin/redis服务器

来自http://reistiago.wordpress.com/2011/07/23/installing-on-redis-mac-os-x/

eh.我也遇到过这个问题。因为在cmd上启动redis服务器,并在其中存储一些密钥。然后我关闭服务器,改为关于redis的Eclipse教程,然后得到这样的异常。解决方案:您只需转到CMD中的redis目录并输入"redis-server.exe redis.conf"即可启动服务器。然后在eclipse中重新运行您以前的应用程序,就可以了!

最新更新