gpt4 book ai didi

java - 在 mac 上通过 java 运行 redis 时权限被拒绝

转载 作者:IT王子 更新时间:2023-10-29 06:05:28 26 4
gpt4 key购买 nike

我正在使用嵌入式 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

还是一样的错误。

有什么想法吗?

最佳答案

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

关于java - 在 mac 上通过 java 运行 redis 时权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32542641/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com