Logstash : "Error: Could not find or load main class Heal" when running logstash.bat

Logstash : "Error: Could not find or load main class Heal" when running logstash.bat

我刚刚在 windows 10 下载了 logstash 7.6.0。我已经有了 elastic search (7.6.0) 和 kibana (7.6.0) 运行ning。当我使用默认配置 运行 logstash.bat 时出现此错误。

错误:无法找到或加载主class修复

我安装了 jdk 11,我检查了环境变量是否已设置。请帮忙。

编辑:添加配置文件

input{
    file =>"D://logfile-2020-03-22.log"
    start_position => "beginning"
    type => "json"
}

output{
    elasticsearch {
        hosts => ["localhost:9200"]
    }
}

实际上,同样的配置在我们的一台服务器上运行良好。但是当我试图在本地设置它时,它给出了这个错误。我能找到的唯一区别是 OS(Windows 服务器 2012 r2 vs windows 10)和 ELK 堆栈的版本(服务器上的 7.6.1 和本地的 7.6.0)

您必须为 logstash 创建一个新的配置文件以输出到 Elasticsearch。给它任何名称,例如 first-pipeline.conf 并粘贴到内容下方。

# The # character at the beginning of a line indicates a comment. Use 
# comments to describe your configuration.
input {
 #standard input
 stdin { }
 #filebeat input
 # beats {
 #    port => "5044"
 #}
}
# The filter part of this file is commented out to indicate that it is
# optional.
# filter {
#
# }
output {
  elasticsearch {
    hosts => [ "localhost:9200" ]
  }
}

现在从命令行 运行 下面的命令

bin>logstash -f first-pipeline.conf

请记住,您不能 运行 从名称中包含 space 的文件夹(如“Program Files”)中登录。将其移动到“C:\myFolderNameWithoutWhitespace”。

看来问题出在我的 Java 安装上,我卸载了 java (java 8) 并下载了 java 版本 11,它解决了问题.