Neo4j 2.0.0RC1 启动服务失败 87

问题描述 投票:0回答:4

我刚刚下载了 RC2。我过去运行的是 1.9,没有任何问题。在 Windows 7 上运行。

这是我安装时发生的情况。所有启动服务的尝试都会失败,并显示 87 错误消息。

C:\Neo4j\Neo4JTest\neo4j-community-2.0.0-RC1\bin>Neo4jInstaller.bat install
"WARNING: this installer is deprecated and may not be the optimal way to install Neo4j on your system."
"Please see the Neo4j Manual for up to date information on installing Neo4j."
Press any key to continue
[SC] CreateService SUCCESS
[SC] StartService FAILED 87:

The parameter is incorrect.

关于警告消息:安装程序似乎没有作为服务安装的选项,并且我在手册中没有看到任何其他作为服务安装的说明。

http://docs.neo4j.org/chunked/2.0.0-RC1/server-installation.html#windows-install

neo4j
4个回答
2
投票

Neo4j 2.0.0-RC1
neo4j-community-2.0.0-RC1-windows
Windows 7

neo4j>bin\Neo4jInstaller.bat install

[SC] CreateService SUCCESS
[SC] StartService FAILED 87:
The parameter is incorrect.

此问题是新 Neo4j 安装 bat 文件中的多个错误组合导致的,这些错误导致

binPath=
文件本身的
sc create service
命令中的
Neo4jInstaller.bat
参数损坏。

具体来说,

sc create
命令需要引用此实例中的
binPath=
参数,因为Neo4j
%binPath%
变量中存在嵌入空格。但是,在
sc create
中创建的
Neo4jInstaller.bat
命令包含未转义的引号以及嵌入在
%javaPath%
变量定义中的
%binPath%
变量中的错误空格。

要解决此问题,需要编辑两个文件:

bin\functions.bat
bin\Neo4jInstaller.bat

%javaPath%
变量中嵌入的无效空格是由
set javaPath="%JAVA_HOME%"
functions.bat
命令中“=”号后面的空格引起的。

%binPath%
中的未转义引号需要在
Neo4jInstaller.bat
中进行三处更改:

  1. 在将其嵌入到
    %javaPath%
    变量中之前,必须删除
    %binPath%
    变量中的引号。
  2. 整个
    %javaPath%\bin\java.exe
    路径必须包含在 引用。
  3. %binPath%
    变量值必须用引号括起来,并且
    %binPath%
    变量中嵌入的引号必须进行转义。

此外,必须修改

functions.bat
中对
Neo4jInstaller.bat
的调用,因为
functions.bat
驻留在
\bin
子目录中,并且
Neo4jInstaller.bat
必须从根
neo4j
目录运行。

functions.bat
=============
:findJavaHome
  if not "%JAVA_HOME%" == "" (

    if exist "%JAVA_HOME%\bin\javac.exe" (
rem      set javaPath= "%JAVA_HOME%\jre"
      set javaPath="%JAVA_HOME%\jre"
      goto:eof
    )

rem    set javaPath= "%JAVA_HOME%"
    set javaPath="%JAVA_HOME%"
    goto:eof
  )


Neo4jInstaller.bat
==================

rem  call functions.bat :findJavaHome
rem set javaPath=%javaPath:"="""%

rem  set binPath="%javaPath%\bin\java.exe %loggingProperties% -DworkingDir="%~dps0.." -DconfigFile=%configFile% %classpath% %mainclass% -Dorg.neo4j.cluster.logdirectory="%~dps0..\data\log" -jar %~dps0%wrapperJarFilename%  %serviceName%"

  call %~dps0functions.bat :findJavaHome
  set javaPath=%javaPath:"=%

  set binPath="%javaPath%\bin\java.exe" %loggingProperties% -DworkingDir="%~dps0.." -DconfigFile=%configFile% %classpath% %mainclass% -Dorg.neo4j.cluster.logdirectory="%~dps0..\data\log" -jar %~dps0%wrapperJarFilename%  %serviceName%

  set binPath="%binPath:"=\"%"


GitHub 上有一个“已关闭”的 Neo4j 票证:https://github.com/neo4j/neo4j/pull/1535,它仅部分修复了 RC2 的这些问题。但是,与此同时,您必须自己解决这个问题。


0
投票

这就是我的发现。

这里有一个注册表项: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services_whatever_you_named_the_service

图像路径有这样的引号:

"C:\Program Files\Java\jdk1.7.0_21\jre"\bin\java.exe ....

我删除了引号

C:\Program Files\Java\jdk1.7.0_21\jre\bin\java.exe ....

现在可以了。

查看bat文件,它从我的JAVA_HOME环境变量中找到javaPath,并在functions.bat中使用引号设置

%javaPath%

然后有一个部分添加三个额外的引号来代替 Neo4jInstaller.bat 第 55 行的 javaPath 中的任何现有引号

set javaPath=%javaPath:"="""%

在 GitHub 上找到了这个,考虑到其他人对此问题的评论,不确定是否会解决这个问题: https://github.com/neo4j/neo4j/pull/1535


0
投票

这是在 google 中搜索时弹出的第一个结果:“[SC] StartService FAILED 87:参数不正确。”

再次检查路径。在大多数情况下,错误位于引用的路径中。

我在使用.NET Core 2.0创建Windows服务时遇到了这个问题。

路径示例:

sc create YourServiceName binPath= "C:\Users\john\source\published\YourServiceName\YourServiceName.exe"

我的错误是空格:

sc create YourServiceName binPath= " C:\Users\john\source\published\YourServiceName\YourServiceName.exe"

0
投票

如果 Windows 注册表中

HKLM\SYSTEM\CurrentControlSet\Services\<SERVICE NAME>\Environment
中的环境配置设置为空字符串,则会弹出相同的错误 (87)。删除它可以解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.