ElasticSearch服务无法启动。找不到JVM

时间:2016-05-25 19:16:05

标签: java windows elasticsearch

我有一个全新的Windows Server 2012,并使用service install安装了ElasticSearch服务。当我尝试启动它但它无法启动时(退出代码1)。

查看日志,它无法找到JVM的路径:

[2016-05-25 19:10:22] [info]  [ 1964] Commons Daemon procrun (1.0.15.0 64-bit) started
[2016-05-25 19:10:22] [info]  [ 1964] Starting service 'elasticsearch-service-x64' ...
[2016-05-25 19:10:22] [info]  [ 2508] Commons Daemon procrun (1.0.15.0 64-bit) started
[2016-05-25 19:10:22] [info]  [ 2508] Running 'elasticsearch-service-x64' Service...
[2016-05-25 19:10:22] [info]  [ 2968] Starting service...
[2016-05-25 19:10:22] [error] [ 2968] Failed creating java %JAVA_HOME%\jre\bin\server\jvm.dll
[2016-05-25 19:10:22] [error] [ 2968] The system cannot find the path specified.
[2016-05-25 19:10:22] [error] [ 2968] ServiceStart returned 1
[2016-05-25 19:10:22] [error] [ 2968] The system cannot find the path specified.
[2016-05-25 19:10:22] [info]  [ 2508] Run service finished.
[2016-05-25 19:10:22] [info]  [ 2508] Commons Daemon procrun finished
[2016-05-25 19:10:24] [error] [ 1964] Failed to start 'elasticsearch-service-x64' service
[2016-05-25 19:10:24] [error] [ 1964] The data area passed to a system call is too small.
[2016-05-25 19:10:24] [info]  [ 1964] Start service finished.
[2016-05-25 19:10:24] [error] [ 1964] Commons Daemon procrun failed with exit value: 5 (Failed to start service)
[2016-05-25 19:10:24] [error] [ 1964] The data area passed to a system call is too small.

但是,JAVA_HOME变量设置正确:

C:\elasticsearch-2.3.3\elasticsearch-2.3.3\bin>dir "%JAVA_HOME%\jre\bin\server\"
 Volume in drive C has no label.
 Volume Serial Number is 6F6F-14E6

 Directory of C:\Program Files\Java\jdk1.8.0_92\jre\bin\server

05/25/2016  06:22 PM    <DIR>          .
05/25/2016  06:22 PM    <DIR>          ..
05/25/2016  06:22 PM        19,136,512 classes.jsa
05/25/2016  06:21 PM         8,775,712 jvm.dll
05/25/2016  06:21 PM             1,423 Xusage.txt
               3 File(s)     27,913,647 bytes
               2 Dir(s)  121,919,512,576 bytes free

我以管理员身份运行控制台。

有什么建议吗?

3 个答案:

答案 0 :(得分:24)

刚刚找到解决方案。我将JAVA_HOME变量从用户变量移动到系统变量。

现在服务正在运行。

答案 1 :(得分:0)

即使在用户变量中定义了JAVA_HOME,我仍然面临着同样的问题

答案 2 :(得分:0)

当您在同一台机器上使用 Maven 时(即 Java 开发人员),您的 JAVA_HOME 必须指向 JDK 主目录,它具有bin 目录,但没有包含 server 的子目录 jvm.dll。该文件位于 jre\bin\server\jvm.dll 中,但未找到。

打开 cmd 窗口,切换到 Elasticsearch 目录,运行 bin/elasticsearch-service manager,转到“Java”选项卡并正确设置 jvm.dll 的路径。

Screenshot