简体   繁体   English

独立Neo4j服务器的附加类路径

[英]additional classpath for standalone Neo4j server

We want to run a neo4j extension (REST API) which requires external JARs and configurations. 我们想运行一个neo4j扩展(REST API),它需要外部JAR和配置。

Even though we can add jars to the {NEO4J_HOME}/plugin/ directory, we want to rely on an already set-up environment including (for example) some /opt/product/lib/ and /var/opt/product/conf/ folders. 即使我们可以将jar添加到{NEO4J_HOME}/plugin/目录,我们{NEO4J_HOME}/plugin/依赖已经设置的环境,包括(例如)一些/opt/product/lib//var/opt/product/conf/文件夹。

This is of course super simple when using Embedded Neo4j Server, but how to do the same when using Standalone Neo4j Server ? 使用嵌入式Neo4j Server时,这当然超级简单,但是使用独立Neo4j Server时该怎么做?

Can we do it? 我们可以做到吗? by configuration ? 通过配置? by any under-the-hood trick ? 通过任何幕后花招?

NB: We are using Neo4j v3.2+ which uses the PowerShell scripts to startup. 注意:我们正在使用Neo4j v3.2 +,该版本使用PowerShell脚本启动。

By editing the Get-Java.ps1 PowerShell script like this: 通过像这样编辑Get-Java.ps1 PowerShell脚本:

# Parse Java config settings - Additional ClassPath
$option = (Get-Neo4jSetting -Name 'dbms.jvm.additional.classpath' -Neo4jServer $Neo4jServer)
$ClassPath="$ClassPath;$([System.Environment]::ExpandEnvironmentVariables($option.Value))"
Write-Warning "WARNING: using classpath: $ClassPath";

$ShellArgs = @("-cp `"$($ClassPath)`""`
              ,'-server' `
              ,'-Dlog4j.configuration=file:conf/log4j.properties' `
              ,'-Dneo4j.ext.udc.source=zip-powershell' `
              ,'-Dorg.neo4j.cluster.logdirectory=data/log' `
              #,'-agentlib:jdwp=transport=dt_socket,address=8998,server=y' `
  )

And adding following configuration in neo4j.conf : 并在neo4j.conf添加以下配置:

#********************************************************************
# JVM Parameters
#********************************************************************

dbms.jvm.additional.classpath=%MY_PRODUCT%/lib/*;%MY_PRODUCT%/conf/*

But as mentioned, this requires manual edit of Neo4j PowerShell scripts, which is not much reliable. 但是如前所述,这需要手动编辑Neo4j PowerShell脚本,可靠性不高。

Could it be added as a supported option ? 可以将其添加为受支持的选项吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM