Can't run Jedis example: JedisConnectionException: Could not get a resource from the pool

Uwat picture Uwat · Apr 23, 2014 · Viewed 17k times · Source

I'm trying the Jedis (Redis for Java) "Basic usage example" from https://github.com/xetorthio/jedis/wiki/Getting-started but I'm getting the following error:

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

I'm trying this on OSX 10.9.2 with Jedis-2.4.2, commons-pool2-2.0

Answer

markthegrea picture markthegrea · Feb 19, 2015

Had the same trouble. All the tutorials online show just running some simple Java BUT you need to have the redis server running on your computer (duh...). As a noobie I thought it all came in the jar but it does not. It is a database just like Mongo or whatever. Try this:

redis download

After you download, unzip it into the UserApps folder (on windows) and then run redis-server.exe. A window will pop up with the port and such in it. Then run your java. Bam, works like a charm!