Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

redis

jedis

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

like image 783
Uwat Avatar asked Apr 23 '14 18:04

Uwat


1 Answers

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!

like image 62
markthegrea Avatar answered Oct 02 '22 20:10

markthegrea