Neo4j windows service fails to recognize apoc.conf, running from console works

  • neo4j community edition 4.1.1 Windows Server
  • apoc-4.1.0.1-all.jar

Creating an apoc.conf file and placing in the conf directory, successfully loads apoc settings when Neo4j is started from the console "neo4j console" command from bin directory.

When starting Neo4j as a windows service "neo4j start" command from bin dir, neo4j works as expected but none of the settings from apoc.conf are loaded.

The only settings I'm using on apoc.conf are (sensitive info below replaced with dummy text and enclosed by brackets [ ]):

apoc.initializer.cypher=call apoc.warmup.run(true,false,true)

apoc.jdbc.sap_hana.url=jdbc:sap://[server]:30015/39015/?user=[user]&password=[pw]
apoc.jdbc.sqlserver.url=jdbc:sqlserver://;servername=[server];databaseName=[db];user=[user];password=[pw]

When running from the console all the above config options are successfully loaded from apoc.conf and confirmed to be working, just not when running as windows service.

Tried uninstalling and reinstalling the service using the corresponding commands to no effect.

Can you please check debug.log for system property NEO4J_CONF set to and/or system property %s is not set, assuming '.' as conf dir. This might cause apoc.conf not getting loaded.?

Additionally can please send the output of jcmd <PID_OF_YOUR_JVM> VM.system_properties.

We basically use system property sun.java.command to figure out the location of the conf folder. I've previously seen that this system property is not set on some windows systems.

Further, can you please create a github issue for apoc from this conversation? Thanks.

debug.log when started as windows service shows:
"2020-08-11 22:47:48.944+0000 INFO [a.ApocExtendedInit] system property NEO4J_CONF set to ."

debug.log when started as console shows:
"2020-08-11 21:42:34.852+0000 INFO [a.ApocExtendedInit] system property NEO4J_CONF set to E:\neo4j-community-4.1.1\conf"

Output of VM.system_properties for the neo4j PID:
"

C:\Program Files\Java\jdk-11.0.8\bin>jcmd 23808 VM.system_properties
23808:
#Thu Aug 13 11:06:04 EDT 2020
sun.desktop=windows
NEO4J_CONF=.
awt.toolkit=sun.awt.windows.WToolkit
jdk.tls.rejectClientInitiatedRenegotiation=true
java.specification.version=11
sun.cpu.isalist=amd64
sun.jnu.encoding=Cp1252
java.class.path=lib/activation-1.1.1.jar;lib/annotations-4.1.1.jar;lib/bcpkix-jd
k15on-1.65.jar;lib/bcprov-jdk15on-1.65.jar;lib/caffeine-2.8.2.jar;lib/commons-be
anutils-1.9.4.jar;lib/commons-collections-3.2.2.jar;lib/commons-compress-1.20.ja
r;lib/commons-io-2.6.jar;lib/commons-lang3-3.10.jar;lib/commons-logging-1.2.jar;
lib/commons-text-1.8.jar;lib/eclipse-collections-10.2.0.jar;lib/eclipse-collecti
ons-api-10.2.0.jar;lib/FastInfoset-1.2.16.jar;lib/hk2-api-2.6.1.jar;lib/hk2-loca
tor-2.6.1.jar;lib/hk2-utils-2.6.1.jar;lib/istack-commons-runtime-3.0.8.jar;lib/j
ackson-annotations-2.11.0.jar;lib/jackson-core-2.11.0.jar;lib/jackson-databind-2
.11.0.jar;lib/jackson-jaxrs-base-2.11.0.jar;lib/jackson-jaxrs-json-provider-2.11
.0.jar;lib/jackson-module-jaxb-annotations-2.11.0.jar;lib/jakarta.activation-1.2
.1.jar;lib/jakarta.activation-api-1.2.1.jar;lib/jakarta.annotation-api-1.3.5.jar
;lib/jakarta.inject-2.6.1.jar;lib/jakarta.validation-api-2.0.2.jar;lib/jakarta.w
s.rs-api-2.1.6.jar;lib/jakarta.xml.bind-api-2.3.2.jar;lib/jamm-0.3.3.jar;lib/jav
assist-3.25.0-GA.jar;lib/javax.servlet-api-3.1.0.jar;lib/javax.ws.rs-api-2.1.1.j
ar;lib/jaxb-api-2.3.0.jar;lib/jaxb-runtime-2.3.2.jar;lib/jctools-core-3.0.0.jar;
lib/jersey-client-2.30.1.jar;lib/jersey-common-2.30.1.jar;lib/jersey-container-s
ervlet-2.30.1.jar;lib/jersey-container-servlet-core-2.30.1.jar;lib/jersey-hk2-2.
30.1.jar;lib/jersey-media-jaxb-2.30.1.jar;lib/jersey-server-2.30.1.jar;lib/jetti
son-1.4.1.jar;lib/jetty-http-9.4.26.v20200117.jar;lib/jetty-io-9.4.26.v20200117.
jar;lib/jetty-security-9.4.26.v20200117.jar;lib/jetty-server-9.4.26.v20200117.ja
r;lib/jetty-servlet-9.4.26.v20200117.jar;lib/jetty-util-9.4.26.v20200117.jar;lib
/jetty-webapp-9.4.26.v20200117.jar;lib/jetty-xml-9.4.26.v20200117.jar;lib/jna-5.
5.0.jar;lib/jPowerShell-3.0.jar;lib/jProcesses-1.6.5.jar;lib/lucene-analyzers-co
mmon-8.5.1.jar;lib/lucene-backward-codecs-8.5.1.jar;lib/lucene-core-8.5.1.jar;li
b/lucene-queryparser-8.5.1.jar;lib/neo4j-4.1.1.jar;lib/neo4j-ast-4.1.1.jar;lib/n
eo4j-batch-insert-4.1.1.jar;lib/neo4j-bolt-4.1.1.jar;lib/neo4j-browser-4.1.0.jar
;lib/neo4j-codegen-4.1.1.jar;lib/neo4j-collections-4.1.1.jar;lib/neo4j-command-l
ine-4.1.1.jar;lib/neo4j-common-4.1.1.jar;lib/neo4j-concurrent-4.1.1.jar;lib/neo4
j-configuration-4.1.1.jar;lib/neo4j-consistency-check-4.1.1.jar;lib/neo4j-csv-4.
1.1.jar;lib/neo4j-cypher-4.1.1.jar;lib/neo4j-cypher-expression-evaluator-4.1.1.j
ar;lib/neo4j-cypher-interpreted-runtime-4.1.1.jar;lib/neo4j-cypher-ir-4.1.1.jar;
lib/neo4j-cypher-logical-plans-4.1.1.jar;lib/neo4j-cypher-macros-4.1.1.jar;lib/n
eo4j-cypher-planner-4.1.1.jar;lib/neo4j-cypher-planner-spi-4.1.1.jar;lib/neo4j-c
ypher-runtime-util-4.1.1.jar;lib/neo4j-data-collector-4.1.1.jar;lib/neo4j-dbms-4
.1.1.jar;lib/neo4j-diagnostics-4.1.1.jar;lib/neo4j-exceptions-4.1.1.jar;lib/neo4
j-expressions-4.1.1.jar;lib/neo4j-fabric-4.1.1.jar;lib/neo4j-front-end-4.1.1.jar
;lib/neo4j-fulltext-index-4.1.1.jar;lib/neo4j-graph-algo-4.1.1.jar;lib/neo4j-gra
phdb-api-4.1.1.jar;lib/neo4j-id-generator-4.1.1.jar;lib/neo4j-import-tool-4.1.1.
jar;lib/neo4j-import-util-4.1.1.jar;lib/neo4j-index-4.1.1.jar;lib/neo4j-io-4.1.1
.jar;lib/neo4j-kernel-4.1.1.jar;lib/neo4j-kernel-api-4.1.1.jar;lib/neo4j-label-i
ndex-4.1.1.jar;lib/neo4j-layout-4.1.1.jar;lib/neo4j-lock-4.1.1.jar;lib/neo4j-log
ging-4.1.1.jar;lib/neo4j-lucene-index-4.1.1.jar;lib/neo4j-monitoring-4.1.1.jar;l
ib/neo4j-native-4.1.1.jar;lib/neo4j-parser-4.1.1.jar;lib/neo4j-procedure-4.1.1.j
ar;lib/neo4j-procedure-api-4.1.1.jar;lib/neo4j-record-storage-engine-4.1.1.jar;l
ib/neo4j-resource-4.1.1.jar;lib/neo4j-rewriting-4.1.1.jar;lib/neo4j-schema-4.1.1
.jar;lib/neo4j-security-4.1.1.jar;lib/neo4j-server-4.1.1.jar;lib/neo4j-spatial-i
ndex-4.1.1.jar;lib/neo4j-ssl-4.1.1.jar;lib/neo4j-storage-engine-api-4.1.1.jar;li
b/neo4j-token-api-4.1.1.jar;lib/neo4j-unsafe-4.1.1.jar;lib/neo4j-util-4.1.1.jar;
lib/neo4j-values-4.1.1.jar;lib/neo4j-wal-4.1.1.jar;lib/netty-all-4.1.48.Final.ja
r;lib/parboiled-core-1.2.0.jar;lib/parboiled-scala_2.12-1.2.0.jar;lib/picocli-4.
2.0.jar;lib/reactive-streams-1.0.3.jar;lib/reactor-core-3.3.5.RELEASE.jar;lib/sc
ala-library-2.12.10.jar;lib/scala-reflect-2.12.10.jar;lib/server-api-4.1.1.jar;l
ib/shiro-cache-1.5.3.jar;lib/shiro-config-core-1.5.3.jar;lib/shiro-config-ogdl-1
.5.3.jar;lib/shiro-core-1.5.3.jar;lib/shiro-crypto-cipher-1.5.3.jar;lib/shiro-cr
ypto-core-1.5.3.jar;lib/shiro-crypto-hash-1.5.3.jar;lib/shiro-event-1.5.3.jar;li
b/shiro-lang-1.5.3.jar;lib/slf4j-api-1.7.30.jar;lib/slf4j-nop-1.7.30.jar;lib/sta
x-ex-1.8.1.jar;lib/txw2-2.3.2.jar;lib/WMI4Java-1.6.3.jar;lib/zstd-jni-1.4.4-11.j
ar;lib/zstd-proxy-4.1.1.jar;plugins/apoc-4.1.0.1-all.jar;plugins/mssql-jdbc-7.4.
1.jre8.jar;plugins/neo4j-graph-data-science-1.3.0-standalone.jar;plugins/Neo4jJD
BC42.jar;plugins/ngdbc.jar
java.vm.vendor=Oracle Corporation
sun.arch.data.model=64
user.variant=
java.vendor.url=https://openjdk.java.net/
user.timezone=America/New_York
java.vm.specification.version=11
os.name=Windows Server 2012 R2
user.country=US
sun.boot.library.path=C:\Program Files\Java\jdk-11.0.8\bin
jdk.debug=release
sun.cpu.endian=little
io.netty.tryReflectionSetAccessible=true
user.home=C:\Windows\system32\config\systemprofile
user.language=en
java.specification.vendor=Oracle Corporation
java.version.date=2020-07-14
java.home=C:\Program Files\Java\jdk-11.0.8
file.separator=\
java.vm.compressedOopsMode=Zero based
line.separator=\r\n
java.specification.name=Java Platform API Specification
java.vm.specification.vendor=Oracle Corporation
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
unsupported.dbms.udc.source=zip
jdk.tls.ephemeralDHKeySize=2048
user.script=
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
java.runtime.version=11.0.8+10-LTS
user.name=
path.separator=;
jdk.nio.maxCachedBufferSize=262144
os.version=6.3
java.runtime.name=Java(TM) SE Runtime Environment
file.encoding=UTF-8
jnidispatch.path=C:\Windows\TEMP\jna--629788263\jna1020701152365200667.dll
sun.nio.ch.bugLevel=
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
java.vendor.version=18.9
jna.loaded=true
java.vendor.url.bug=https://bugreport.java.com/bugreport/
jetty.git.hash=7b38981d25d14afb4a12ff1f2596756144edf695
java.io.tmpdir=C:\Windows\TEMP\
java.version=11.0.8
user.dir=E:\neo4j-community-4.1.1
os.arch=amd64
java.vm.specification.name=Java Virtual Machine Specification
java.awt.printerjob=sun.awt.windows.WPrinterJob
sun.os.patch.level=
java.library.path=E:\neo4j-community-4.1.1\bin\tools;C:\Windows\Sun\Java
\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk-11.0.8\
bin;C:\Windows\SysWOW64;C:\Program Files (x86)\Common Fi
les\Oracle\Java\javapath;C:\Windows\system32
;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerS
hell\v1.0\;C:\Program Files\Common Files\Oracle
\Java\javapath;.
java.vendor=Oracle Corporation
java.vm.info=mixed mode
java.vm.version=11.0.8+10-LTS
sun.io.unicode.encoding=UnicodeLittle
java.class.version=55.0

"

Thanks for the steps and will create the github issue under the apoc project.

There's no sun.java.command system property being listed, therefore parsing sun.java.command for the conf folder location fails. In this case we use "." as default location for apoc.conf.

Maybe you can figure out what is "." when you start it via service and put apoc.conf there?