Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start redis server on own executable fail #86

Open
zhouhoo opened this issue May 22, 2017 · 6 comments
Open

start redis server on own executable fail #86

zhouhoo opened this issue May 22, 2017 · 6 comments

Comments

@zhouhoo
Copy link

zhouhoo commented May 22, 2017

When use fellow way to create a redis server based on own executable, it fail .
String redisPath ="/usr/local/bin/redis-server"; File file = new File(redisPath); RedisServer redisServer = new RedisServer(file, 6379);
with error as fellow:
Exception in thread "main" 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.blue.util.VoiceRecognation.start_s(VoiceRecognation.java:44) at com.blue.util.VoiceRecognation.main(VoiceRecognation.java:167) Caused by: java.io.IOException: Cannot run program "/usr/local/bin/redis-server " (in directory "/usr/local/bin"): error=2,no such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) at redis.embedded.AbstractRedisInstance.start(AbstractRedisInstance.java:37) ... 3 more Caused by: java.io.IOException: error=2, no such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.<init>(UNIXProcess.java:187) at java.lang.ProcessImpl.start(ProcessImpl.java:130) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028) ... 4 more
but the file is truly there and with 755 .
my own redis executable version is 3.2 , ubuntu14.04.
so this is a bug?

@tklovett
Copy link

It looks like there is an extra trailing space in the name of the executable that ProcessBuilder is attempting to start: "/usr/local/bin/redis-server ". Is there a typo in your assignment to String redisPath? Or maybe something is modifying it before it's passed to new ProcessBuilder(args);?

@tklovett
Copy link

tklovett commented May 23, 2017

For anyone else with my issue: I got this same error attempting to run my application within Alpine Linux -- the embedded redis-server-2.8.19 OsArchitecture.UNIX_x86_64 executable is successfully extracted from the Jar to /tmp/*, but Alpine is unable to execute it.

@izebit
Copy link

izebit commented Aug 2, 2017

@tklovett I faced with this problem too and I suggest that I have found a reason of the error. The problem in Alpine distribution, the os does't work with the format of program. It needs recompilation of redis, which contains in jar. So, if you want read about it more , you can go to https://github.com/awslabs/amazon-kinesis-producer/issues/86

@mengjiann
Copy link

As similar to the situation above, I encountered the problem with running the embedded redis server in a Docker container. The image was originated from java:8-jre-alpine. It works after changing the base image to: openjdk:8-jre. But, the built docker image becomes larger though :)

@IEnoobong
Copy link

Any way to fix this other than changing the base image please?

@ycyin
Copy link

ycyin commented Feb 21, 2024

As similar to the situation above, I encountered the problem with running the embedded redis server in a Docker container. The image was originated from java:8-jre-alpine. It works after changing the base image to: openjdk:8-jre. But, the built docker image becomes larger though :)

yeah! I change maven:3.9.6-eclipse-temurin-11-alpine to maven:3.9.6-eclipse-temurin-11 and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants