Cannot run Neo4j 4.0 (Community Edition) with APOC 4.0

If I remove the APOC (apoc-4.0.0.0-all) plugin it starts fine.
(running community edition 4.0 on Windows Server 2019)

Can anyone else confirm this, and if so I will submit a github issue (for APOC not neo4j correct?)

Thanks!

Here's the neo4j.log output:

2020-01-22 13:15:27 Apache Commons Daemon procrun stdout initialized.
2020-01-22 19:15:30.774+0000 INFO  ======== Neo4j 4.0.0 ========
2020-01-22 19:15:30.805+0000 INFO  Starting...
2020-01-22 19:15:36.352+0000 ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabaseService@2042ccce' was successfully initialized, but failed to start. Please see the attached cause exception "null". Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabaseService@2042ccce' was successfully initialized, but failed to start. Please see the attached cause exception "null".
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabaseService@2042ccce' was successfully initialized, but failed to start. Please see the attached cause exception "null".
	at org.neo4j.server.exception.ServerStartupErrors.translateToServerStartupError(ServerStartupErrors.java:45)

Can you please post the server version? Is it release version of community edition?

I tried the latest server and apoc combination. There were no issues with startup.

Thanks
Ravi

4.0.0
Downloaded from https://neo4j.com/download-center/#community today

I can post the debug.log if that is helpful...

Please post the debug.log and neo4j.log. That definitely helps in troubleshooting the issue.

Also - running AdoptOpenJDK JRE 11.0.6.10.. I can try the Oracle one if that matters.

log bundle is here: http://resources.bluenetinc.com/attachment/logs.zip

This is a bug in APOC 4.0.0. I guess you can workaround by using JDK instead of JRE - OpenJDK 11 should do, no need for the Oracle variant.
This should be fixed rather quickly, I'm on it.

Thanks for the follow-up.

I did a quick test by uninstalling the OpenJava (I had used the AdoptOpenJDK x64 11.0.6 downloaded from ninite.com).

Instead installed: https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot

I then removed and re-added the neo4j service

result is still the same:service crashed when APOC is included.

Not a problem for me, at this moment, this is just a testing station to determine readiness to move my project to 4.0.x

APOC 4.0 uses a system property sun.java.command to figure out the location of the config dir. Here it has e.g. this value com.neo4j.server.enterprise.EnterpriseEntryPoint --home-dir=/home/stefan/neo4j-enterprise-4.0.0 --config-dir=/home/stefan/neo4j-enterprise-4.0.0/conf
Then we use the config dir to load apoc.conf.

I've tried various versions of JVM and JRE on my Linux machine. All of them do have a sun.java.command system property. However on your Windows Server box, debug.log shows that this system property does not exist. I have no clue why sun.java.command is missing.

It's easy to change the code to gracefully deal with this. However this has the consequence that you can't load apoc.conf and need to rely on setting env variables or system properties to configure apoc.

I don't have any JAVA background, so I'm not exactly sure what this means. Prior to n4j 4.0 I had 3.5x running using Java 8. N4J 4.0 said I had to use 11, so I uninstalled (Oracle) Java 8, and added OpenJDK 11, and here I sit.

Is there a way to add the sun.java.command system property on my Windows server?

You don't have to add it. Any JVM should do this on their own.

I've just asked a colleague to test it on Windows. He ran it on Windows 10 and there sun.java.command shows up. debug.log dumps all system properties upon startup. On his machine we got

2020-01-24 10:29:56.856+0000 INFO [o.n.i.d.DiagnosticsManager] VM Name: OpenJDK 64-Bit Server VM
2020-01-24 10:29:56.857+0000 INFO [o.n.i.d.DiagnosticsManager] VM Vendor: AdoptOpenJDK
2020-01-24 10:29:56.857+0000 INFO [o.n.i.d.DiagnosticsManager] VM Version: 11.0.1+13
....
2020-01-24 10:29:56.978+0000 INFO [o.n.i.d.DiagnosticsManager] --------------------------------------------------------------------------------
2020-01-24 10:29:56.979+0000 INFO [o.n.i.d.DiagnosticsManager]                              [ System properties ]                              
2020-01-24 10:29:56.979+0000 INFO [o.n.i.d.DiagnosticsManager] --------------------------------------------------------------------------------
...
2020-01-24 10:29:56.980+0000 INFO [o.n.i.d.DiagnosticsManager] sun.java.command = com.neo4j.server.enterprise.EnterpriseEntryPoint --config-dir=D:\Databases\Neo4j\Enterprise\neo4j-enterprise-4.0.0-rc01\conf --home-dir=D:\Databases\Neo4j\Enterprise\neo4j-enterprise-4.0.0-rc01

So this is AdoptOpenJDK 11 as well. I don't have any idea why sun.java.command is missing on your machine. Since it's not an issue affecting all folks on Windows, I'll push a change which fixes the exception and makes sure Neo4j + apoc start up nicely but spit out a warning that apoc.conf couldn't be loaded.

I'm curious if this has anything to due with an artifact of having Oracle/Sun Java 8, uninstalling, then installing AdoptOpenJDK...

I'll hunt down a couple more Windows machines that I've got an older version of n4j running on, and see if I can recreate the problem.

Ok - I managed to recreate the problem on another Windows machine:

Neo4j Community 3.5.14 (with APOC 3.5.0.6) running AdoptOpenJDK 8.0.232.09 -> working just fine

Installed AdoptOpenJDK 11 (over the top)
update the JAVA_HOME path (to use the 11 version)
uninstall neo4j service (3.5.14)
install neo4j service (4.0.0)
Start Neo4j (4.0.0) -> works fine
Add the APOC 4.0 plugin

Seems to me that upgrading from JAVA 8 to JAVA 11 may be the crux of the issue here... I can supply logs from this other machine if that would be at all helpful in validating this problem scenario.

1 Like

I can confirm https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/tag/4.0.0.1
fixed the problem, and I can now run Neo4j 4.0 with APOC 4.0.0.1.

I tried uninstalls/reboots, clearing out JAVA references from the registry/environment variables
I could find nothing that appears to be able to bring back the missing sun.java.command system property when upgrading/replacing JRE/JDK 8 with JDK 11. It seems almost impossible for me to NOT reproduce this problem when upgrading JAVA on Windows.

Thanks for the follow-up Neo4j team!

1 Like

Cool. Just be aware that you cannot use a apoc.conf file to supply apoc configuration. Instead you need to use either environment variables or system properties. See apoc docs for details.

Thanks Stefan. If anyone else has any ideas on how to "properly" upgrade to JAVA 11 on Windows without loosing the sun.java.command system property I'd love to hear suggestions!