51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

logstash7.x版本启动时找不到系统默认java

因项目需要,在openEuler系统环境中部署logstash等服务,启动时报错:

Sep 29 14:32:06 localhost logstash[22492]: Using bundled JDK: /home/test/logstash-7.xx.x/jdk
Sep 29 14:32:06 localhost logstash[22501]: /home/test/logstash-7.xx.x/bin/logstash.lib.sh: line 141: /home/test/logstash-7.xx.x/jdk/bin/java: cannot execute binary file: Exec format error
Sep 29 14:32:06 localhost logstash[22501]: /home/test/logstash-7.xx.x/bin/logstash.lib.sh: line 141: /home/test/logstash-7.xx.x/jdk/bin/java: Success
Sep 29 14:32:06 localhost logstash[22492]: /home/test/logstash-7.xx.x/bin/logstash: line 60: /home/test/logstash-7.xx.x/jdk/bin/java: cannot execute binary file: Exec format error
Sep 29 14:32:06 localhost logstash[22492]: /home/test/logstash-7.xx.x/bin/logstash: line 60: /home/test/logstash-7.xx.x/jdk/bin/java: Success

解决办法

编辑bin/logstash文件,在开头添加如下内容即可。

JAVA_CMD=`readlink /etc/alternatives/java |sed -r 's#java$##g'`
JAVA_HOME=`readlink /etc/alternatives/java |sed -r 's#bin/java$##g'`
赞(1)
未经允许不得转载:工具盒子 » logstash7.x版本启动时找不到系统默认java