Embedded Neo4j APOC procedure apoc.load.json not working - neo4j

I went through a couple of similar threads but none save my problem. I am running an embedded Neo4j instance (version 3.5, enterprise edition). When configuring DB I override plugin dir to location where I have my APOC jar (also 3.5 version).
Here is neo4j.conf file:
dbms.logs.debug.level=DEBUG
dbms.security.procedures.unrestricted=apoc.*
dbms.security.procedures.whitelist=apoc.*
apoc.export.file.enabled=true
apoc.import.file.enabled=true
I can confirm that configuration is correctly read upon database setup since on listing of configs (using dbms.listConfig()) I can confirm custom settings are present.
Issue occur upon running APOC procedure apoc.load.json:
Failed to invoke procedure `apoc.load.json`: Caused by: java.lang.RuntimeException: Import from files not enabled, please set apoc.import.file.enabled=true in your neo4j.conf
Also other APOC procedure (fore example apoc.util.validate works without issues).

Related

Neo4J crashes after installing APOC plugin

I'm trying to install the APOC Full jar file (4.2.0.6) to my Neo4J instance that's running in a Google Compute VM. To do so, I've installed the JAR file from GitHub releases to the /plugins folder. Each time I restart or run the environment it crashes with the following output to logs:
"Some jar procedure files (apoc-4.2.0.6-all.jar) are invalid, see log for details."
There's really no additional details provided...
If I copy the default APOC Core library found withing /labs, it works. I've tried to download this same file from Github and it fails. I've verified that the same user/group permissions are applied to the downloaded file as well.
Any ideas?
This usually happens for two reasons:
First is version mismatch. You can check which version you should use based on the version matrix, which is available at: https://github.com/neo4j-contrib/neo4j-apoc-procedures#version-compatibility-matrix. Unfortunately, it is not always up to date, but the APOC versions are if I understand correctly:
APOC 4.1.x.x -> Neo4j 4.1.x
APOC 4.2.x.x.-> Neo4j 4.2.x
APOC 4.3.x.x -> Neo4j 4.3.x
If I had to guess, you are probably using Neo4j 4.3 or 4.1 and using an APOC that is designed to work with Neo4j 4.2.
The other issue is that sometimes you have multiple APOC plugin files in the plugin folders, so that will also crash Neo4j.

Neo4J 4 + Apoc : Unable to set up injection for procedure 'Static'

Getting the following error on neo4j server startup with the apoc plugin.
Have copied the jar to the plugins folder.
Caused by:
org.neo4j.kernel.api.exceptions.ComponentInjectionException: Unable to
set up injection for procedure 'Static', the field 'apocConfig' has
type 'class apoc.ApocConfig' which is not a known injectable component
Neo4j version: 4.0.4
Apoc version: 4.0.0.13
What could be the problem?
I would suggest reviewing the installation procedure to see if you missed any steps,
https://neo4j.com/docs/operations-manual/current/installation/linux/
Also, double check the java version that neo4j is using, and check if there are any other local java environment factors specific to this install. class paths, other jars, etc.
We were having the same issue with neo4j 4.x and custom plugin folder.
Updating custom plugin folder in neo4j config didn't work, we had to add folder (or extension) into java CP (classpath) as well.
It worked in 3.x neo4j version without adding a folder into the classpath.
Try to make sure that you have plugins folder listed in -cp and might work for you.
Similar to Ilija's problem, our embedded database (using Eclipse with the Maven plugin) did not like our custom plugin folder.
Since the database was for setup and then deployment (effectively 2 separate things), we could move the database from the default Neo4j directory after it was setup.
As a test, you could delete the contents of your plugin folder and see if it works then.

Error when tring to execute apoc.refactor.mergeNodes

I have neo4j version server 3.5.18 and I've installed apoc version 3.5.0.11. I think that I have correctly modified the conf file in this way
dbms.directories.plugins=/Users/lx2pwnd/Desktop/dev/neo4j-community-3.5.18/plugins
...
dbms.security.procedures.unrestricted=algo.*,apoc.*
...
dbms.security.procedures.whitelist=apoc.coll.*,apoc.load.*
But when I try to execute a query which contains CALL apoc.refactor.mergeNodes(..) i get this error:
There is no procedure with the name `apoc.refactor.mergeNodes` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.
What's wrong ?
I believe the plugins path needs to be relative to the neo4j installation directory. This is safer, since different neo4j versions can be installed simultaneously, and they may need different plugin versions.
Try changing the dbms.directories.plugins value back to plugins, putting the APOC jar file in the existing plugins directory under your neo4j installation directory, and restarting neo4j.

APOC: unavailable namespaces

Just added apoc to a neo4j installation. As a result, got access to the namespaces apoc.coll and apoc.load only. Can't even do basic stuff like RETURN apoc.version().
The jar in the plugins directory contains much more than that, but in the localhost browser, I can't see anything but the above. Both apoc and neo4j version 3.3.
Before editing the config file, apoc was totally unavailable. Additions to config:
dbms.security.procedures.whitelist=apoc.coll.*,apoc.load.*
dbms.security.procedures.unrestricted=apoc.coll.*,apoc.load.*
dbms.security.procedures.whitelist=apoc.algo.*,apoc.atomic.*
dbms.security.procedures.unrestricted=apoc.algo.*,apoc.atomic.*
dbms.security.procedures.whitelist=apoc.trigger.*,apoc.meta.*
dbms.security.procedures.unrestricted=apoc.trigger.*,apoc.meta.*
dbms.security.procedures.whitelist=apoc.*
dbms.security.procedures.unrestricted=apoc.*
apoc.trigger.enabled=true
apoc.ttl.enabled=true
apoc.ttl.schedule=5
apoc.import.file.use_neo4j_config=true
apoc.import.file.enabled=true
apoc.export.file.enabled=true
# apoc.jdbc.<key>.uri=jdbc-url-with-credentials
# apoc.es.<key>.uri=es-url-with-credentials
# apoc.mongodb.<key>.uri=mongodb-url-with-credentials
# apoc.couchbase.<key>.uri=couchbase-url-with-credentials
apoc.jobs.scheduled.num_threads=number-of-threads
apoc.jobs.default.num_threads=number-of-threads
I added 'algo' and 'atomic' as an experiment, as I was thinking that I could see 'load' and 'coll' simply because they were declared in the config. But no - didn't help.
Restarted neo4j and rebooted the machine repeatedly.

Neo4j 3.1.0 apoc.export.graphml issue

I am trying to export my db as a graphml file via the apoc.export.graphml procedure in Neo4j 3.1 + 3.1.0.3:
call apoc.export.graphml.all("test",{})
I get this error message:
Failed to invoke procedure apoc.export.graphml.all: Caused by:
java.lang.RuntimeException: Import from files not enabled, please set
apoc.import.file.enabled=true in your neo4j.conf
I have edited my neo4j.conf file to add
apoc.import.file.enabled=true
at the end of the document but I'm still getting the same error message.
What am I doing wrong?
Thanks for your help.
I had the same problem and did not find any from anywhere. I just managed to resolved this issue. Hopefully, this solves yours as well.
Environment: MacOs, Neo4j 3.1.2 CE
1) Change your .neo4j.conf (mine is under my ~/Documents/Neo4j/). You can easily edit by pressing [Options...] button. I commented the import directory comment out as well, just in case.
#dbms.directories.import=import
apoc.import.file.enabled=true
2) I originally have the apoc-3.1.2.5.jar under ~/Documents/Neo4j/default.graphdb/plugins/ directory which worked except reading xml from the local disk. So, I put the jar under my app directory, /Applications/Neo4j.app/Contents/Resources/app/plugins
The "Neo4j.app" is my symbolic link. You probably will see the app directory as "Neo4j Community Edition 3.1.2.app"
3) Do Not restart by pressing [Stop] and [Start], make sure you quit the Neo4j and relaunch. Stop and Start seems to reload config but it does not seem to load jar from plugins.
4) How to check:
call apoc.config.list
You should see:
apoc.import.file.enabled true
I originally added
apoc.import.file.enabled=true
to the end of the neo4j.conf file and "HTTP logging configuration" section.
I moved the comment to the "Server configuration" section and now it works.

Resources