I trust this message finds you all in good spirits. I'm currently immersed in a project that involves leveraging Neo4j for spatial data, and I've encountered a challenge while attempting to integrate the Neo4j-Spatial extension. My project environment is based on a Docker container created using Docker-Compose, and I'm seeking assistance with addressing compatibility and setup issues.
Here's a concise overview of my setup:
Neo4j version: 4.4.14
Deployment: Docker via Docker-Compose
I've shared the relevant part of my Docker-Compose configuration for the Neo4j instance below:
Moved the downloaded .jar to the /var/lib/neo4j/plugins directory.
Updated the NEO4JLABS_PLUGINS environment variable to include "spatial".
Despite following these steps, I encounter an error every time I attempt to run my Neo4j instance. Has anyone in the community faced a similar problem or successfully integrated Neo4j-Spatial in a Neo4j 4.4.14 Docker container?
Your insights and assistance would be greatly appreciated.
The NEO4J_PLUGINS is just a helper utility to download specified plugins into your plugins folder. Adding "spatial" to the plugins list is just gonna confuse the utility because it doesn't know about that plugin, and you already have it anyway. Maybe that is the error message you're referring to?
Anyway this is my advice:
You don't need to mount stuff to /var/lib/neo4j/whatever. The supported mount points are listed here: Persisting data with Docker volumes - Operations Manual (I know that is 5 documentation and you're using 4.4 but there isn't an equivalent 4.4 page and all the information there still applies in 4.4).
Using the supported mount points adds a load of permissions checks and will generally make things easier. For you that would be /data, /plugins and /import.
Mounting a folder of plugins to /plugins means that neo4j will load (or at least attempt to load) those plugins on start up. Other than the configuration settings you already have, that's all that's required to install plugins in docker. The neo4j 5 documentation about plugins also applies to 4.4 Plugins - Operations Manual
Mounting a folder/volume to /plugins and using NEO4J_PLUGINS means you'll get the plugin downloaded to your folder when you run the docker container. So your plugins folder should contain apoc, gds and spatial (which you downloaded yourself already). No need to specify NEO4J_PLUGINS after that because the plugins are already downloaded. Plugins - Operations Manual
Now I have better understanding about using Neo4j with Docker.
As I mentioned before, I was able to built the neo4j instance with spatial.jar in /plugins directory. The problem appears when I try to launch neo4j with gds and apoc.
The error that I get is the following (sorry for no sharing before ):
java.lang.RuntimeException: Error starting Neo4j database server at /data/databases
neo4j | at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:227) ~[neo4j-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:180) ~[neo4j-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.server.CommunityBootstrapper.createNeo(CommunityBootstrapper.java:36) ~[neo4j-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:142) [neo4j-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:95) [neo4j-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:34) [neo4j-4.4.14.jar:4.4.14]
neo4j | Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'apoc.ApocConfig@5763a655' failed to initialize. Please see the attached cause exception "'org.apache.commons.text.lookup.StringLookup org.apache.commons.text.lookup.StringLookupFactory.dnsStringLookup()'".
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:424) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:65) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.extension.AbstractExtensions.init(AbstractExtensions.java:77) ~[neo4j-kernel-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:403) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:65) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:101) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:218) ~[neo4j-4.4.14.jar:4.4.14]
neo4j | ... 5 more
neo4j | Caused by: org.apache.commons.configuration2.ex.ConfigurationRuntimeException: java.lang.reflect.InvocationTargetException
neo4j | at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:357) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:371) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:383) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResultInstance(BasicConfigurationBuilder.java:361) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:338) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:234) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.getDefinitionConfiguration(CombinedConfigurationBuilder.java:584) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.createResultDeclaration(CombinedConfigurationBuilder.java:608) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getResultDeclaration(BasicConfigurationBuilder.java:391) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResultInstance(BasicConfigurationBuilder.java:361) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:338) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:234) ~[apoc.jar:4.4.0.12]
neo4j | at apoc.ApocConfig.loadConfiguration(ApocConfig.java:196) ~[apoc.jar:4.4.0.12]
neo4j | at apoc.ApocConfig.init(ApocConfig.java:156) ~[apoc.jar:4.4.0.12]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:403) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:65) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.extension.AbstractExtensions.init(AbstractExtensions.java:77) ~[neo4j-kernel-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:403) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:65) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:101) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:218) ~[neo4j-4.4.14.jar:4.4.14]
neo4j | ... 5 more
neo4j | Caused by: java.lang.reflect.InvocationTargetException
neo4j | at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
neo4j | at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
neo4j | at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
neo4j | at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
neo4j | at org.apache.commons.configuration2.beanutils.DefaultBeanFactory.createBeanInstance(DefaultBeanFactory.java:125) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.DefaultBeanFactory.createBean(DefaultBeanFactory.java:99) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:355) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:371) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:383) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResultInstance(BasicConfigurationBuilder.java:361) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:338) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:234) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.getDefinitionConfiguration(CombinedConfigurationBuilder.java:584) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.createResultDeclaration(CombinedConfigurationBuilder.java:608) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getResultDeclaration(BasicConfigurationBuilder.java:391) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResultInstance(BasicConfigurationBuilder.java:361) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:338) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:234) ~[apoc.jar:4.4.0.12]
neo4j | at apoc.ApocConfig.loadConfiguration(ApocConfig.java:196) ~[apoc.jar:4.4.0.12]
neo4j | at apoc.ApocConfig.init(ApocConfig.java:156) ~[apoc.jar:4.4.0.12]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:403) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:65) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.extension.AbstractExtensions.init(AbstractExtensions.java:77) ~[neo4j-kernel-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:403) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:65) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:101) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:218) ~[neo4j-4.4.14.jar:4.4.14]
neo4j | ... 5 more
neo4j | Caused by: java.lang.NoSuchMethodError: 'org.apache.commons.text.lookup.StringLookup org.apache.commons.text.lookup.StringLookupFactory.dnsStringLookup()'
neo4j | at org.apache.commons.configuration2.interpol.DefaultLookups.<clinit>(DefaultLookups.java:100) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.interpol.ConfigurationInterpolator$DefaultPrefixLookupsHolder.createDefaultLookups(ConfigurationInterpolator.java:647) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.interpol.ConfigurationInterpolator$DefaultPrefixLookupsHolder.<init>(ConfigurationInterpolator.java:627) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.interpol.ConfigurationInterpolator$DefaultPrefixLookupsHolder.<clinit>(ConfigurationInterpolator.java:614) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.interpol.ConfigurationInterpolator.getDefaultPrefixLookups(ConfigurationInterpolator.java:290) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.AbstractConfiguration.installDefaultInterpolator(AbstractConfiguration.java:375) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.AbstractConfiguration.<init>(AbstractConfiguration.java:122) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.AbstractHierarchicalConfiguration.<init>(AbstractHierarchicalConfiguration.java:166) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.BaseHierarchicalConfiguration.<init>(BaseHierarchicalConfiguration.java:82) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.BaseHierarchicalConfiguration.<init>(BaseHierarchicalConfiguration.java:73) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.BaseHierarchicalConfiguration.<init>(BaseHierarchicalConfiguration.java:61) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.XMLConfiguration.<init>(XMLConfiguration.java:222) ~[apoc.jar:4.4.0.12]
neo4j | at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
neo4j | at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
neo4j | at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
neo4j | at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
neo4j | at org.apache.commons.configuration2.beanutils.DefaultBeanFactory.createBeanInstance(DefaultBeanFactory.java:125) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.DefaultBeanFactory.createBean(DefaultBeanFactory.java:99) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:355) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:371) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:383) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResultInstance(BasicConfigurationBuilder.java:361) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:338) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:234) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.getDefinitionConfiguration(CombinedConfigurationBuilder.java:584) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.createResultDeclaration(CombinedConfigurationBuilder.java:608) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getResultDeclaration(BasicConfigurationBuilder.java:391) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResultInstance(BasicConfigurationBuilder.java:361) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:338) ~[apoc.jar:4.4.0.12]
neo4j | at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:234) ~[apoc.jar:4.4.0.12]
neo4j | at apoc.ApocConfig.loadConfiguration(ApocConfig.java:196) ~[apoc.jar:4.4.0.12]
neo4j | at apoc.ApocConfig.init(ApocConfig.java:156) ~[apoc.jar:4.4.0.12]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:403) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:65) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.extension.AbstractExtensions.init(AbstractExtensions.java:77) ~[neo4j-kernel-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:403) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:65) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:101) ~[neo4j-common-4.4.14.jar:4.4.14]
neo4j | at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:218) ~[neo4j-4.4.14.jar:4.4.14]
neo4j | ... 5 more
As far as I can understand in this log message, probably the error is caused by an incompatibility between spatial and apoc plugin.
Another posibility is that the spatial.jaris compiled for version 4.4.3 and I am using an newer version of Neo4j.
Which features of the spatial library do you want / plan to use?
It's probably a dependency conflict that occurs. Perhaps try with apoc-core first before adding gds or apoc-extended/full. Most likely the different libs have been built against different targets.
Is there a reason why you're still on 4.4.x?
All of the current development happens for the latest versions of the libraries in the Neo4j 5.x branch.
Spatial was just picked up again by Andreas Berger and updated for 5.x
After testing with various combinations, I can confirm that the apoc plugin is the source of the issue. When I run the Docker Compose setup solely with gds and spatial, Neo4j launches without any problems.
The reason I'm still using Neo4j 4.4.x is due to dependencies in my application relying on certain methods within the apoc plugin. These methods have undergone refactoring in Neo4j 5.x, necessitating a more careful transition.
My goal is to luse the Spatial plugin for handling geographic information in WKT format, enabling me to execute spatial operations between points, polygons, and more.
One more question: I saw in GitHub repository that the last realese of neo4j-spatial was for 4.4.3. I am right?