通过java上的java运行redis时权限被拒绝

时间:2015-09-12 19:05:31

标签: java macos unix junit redis

我正在使用嵌入式redis项目https://github.com/kstyrc/embedded-redis 试图通过我的单元测试来运行它。我在mac机器上。

我的redis impl在目录上:/ Users / myname / servers / redis-unstable

一旦我尝试运行它:

@Before
    public void init() throws IOException {     
        redisServer = new RedisServer(new File("/Users/myname/servers/redis-unstable"), 6379);   
        redisServer.start();
    }

我获得了许可:

redis.embedded.exceptions.EmbeddedRedisException: Failed to start Redis instance
    at redis.embedded.AbstractRedisInstance.start(AbstractRedisInstance.java:42)
    at redis.embedded.RedisServer.start(RedisServer.java:9)
    at com.zone.world_map_service_web.LocationServiceTest.init(LocationServiceTest.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.io.IOException: Cannot run program "/Users/myname/servers/redis-unstable" (in directory "/Users/myname/servers"): error=13, Permission denied
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at redis.embedded.AbstractRedisInstance.start(AbstractRedisInstance.java:37)
    ... 29 more
Caused by: java.io.IOException: error=13, Permission denied
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 30 more

我尝试了一切..做了chmod 755 chmod u + x

仍然是同样的错误。

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

下载后运行make命令吗?我认为即使它是不稳定的版本,你也会寻找redis-server而不是redis-unstable。