File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes Threadpool RMI jedis integration - Permission issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Threadpool RMI jedis integration - Permission issue" Watch "Threadpool RMI jedis integration - Permission issue" New topic

Threadpool RMI jedis integration - Permission issue

raja peter

Joined: Sep 16, 2010
Posts: 2

I've a Threadpool whose scheduled threads access the redis pool and perform some query with it.

I create the JedisPool instance as static in a class in which ThreadPool is created. I pass the JedisPool instance as a parameter while constructing each task. My constructor will be public TestTask(DataSource ds, JedisPool pool, int xx, int yy). Since the task also requires a mysql connection I pass an instance of mysql connection pool's datasource. All these files are in a "packagen".

My server.policy file is in "/home/raja/parent_to_package/" directory and looks like this,

grant codeBase "file:/home/raja/parent_to_package/" {


permission ":","connect,resolve";


grant codeBase "file:/home/raja/parent_to_package/packagen/" {


permission ":","connect,resolve";


I run the program from parent_to_package directory like

java -Djava.rmi.server.codebase=file:/home/raja/parent_to_package/interface.jar -Djava.rmi.server.hostname= -Xmx256m -Xms256m packagen.MainClass

Still I get the following exception from the child threads.

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at redis.clients.util.Pool.getResource( at at java.util.concurrent.Executors$ at java.util.concurrent.FutureTask$Sync.innerRunAndReset( at java.util.concurrent.FutureTask.runAndReset( at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101( at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic( at java.util.concurrent.ScheduledThreadPoolExecutor$ at java.util.concurrent.ThreadPoolExecutor$Worker.runTask( at java.util.concurrent.ThreadPoolExecutor$ at java.util.concurrent.Executors$PrivilegedThreadFactory$1$ at Method) at java.util.concurrent.Executors$PrivilegedThreadFactory$ at

Caused by: access denied ( connect,resolve) at at at java.lang.SecurityManager.checkPermission( at java.lang.SecurityManager.checkConnect( at at at at at redis.clients.jedis.Connection.connect( at redis.clients.jedis.Jedis.connect( at redis.clients.jedis.JedisPool$JedisFactory.makeObject( at org.apache.commons.pool.impl.GenericObjectPool.borrowObject( at redis.clients.util.Pool.getResource( ... 13 more
I agree. Here's the link:
subject: Threadpool RMI jedis integration - Permission issue
It's not a secret anymore!