Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-06-2021 01:35 AM
Hi! I'm trying to import an json file to neo4j, but it shows this error. I already changed the settings and imported the file to the right location. Can please someone help? Thank you in advance.
Cypher statement: //Load_JSON_Country
CALL apoc.load.json("file:///countries.json")
YIELD value
Settings: #apoc
apoc.import.file.enabled=true
apoc.import.file.use_neo4j_config=true
Error: Failed to invoke procedure
apoc.load.json
: Caused by: java.io.IOException: You're providing a directory outside the import directory defined intodbms.directories.import
Solved! Go to Solution.
12-06-2021 07:10 AM
I change the settings to this:
dbms.directories.import = C:/
apoc.import.file.enabled=true
dbms.security.procedures.unrestricted=jwt.security.,apoc.,gds.,n10s.
And then, the path for this:
//Load_JSON_Country
CALL apoc.load.json("/Users/.Neo4jDesktop/relate-data/dbmss/dbms-1f5f63ad-bba8-4673-8d16-2a3bd7299f65/import/countries.json")
YIELD value
RETURN value
And it worked!
Thank you!
12-06-2021 01:57 AM
Hi @Mariana ,
Could you share some details about which version of Neo4j you're using, on what OS platform, and how you're running it (Desktop, Docker, something else).
Best,
ABK
ps. This is a cross-post from StackOverflow, correct?
12-06-2021 02:04 AM
Hi!
I'm using Neo4j Desktop, version 1.4.7 on Windows x64. I don't know if the error may be related to the number of databases I already have... At the moment I have 10 and I am using the free version.
And yes, I put the same post on StackOverflow.
Thank you!
Mariana
12-06-2021 02:39 AM
OK. It is most likely that you are running into a challenge with using the file:
URI scheme on Windows. I'm not on Windows at the moment, but an alternative is to ignore the file:
scheme and use http:
instead. How?
Neo4j Desktop hosts project files with a local http server. In Desktop, click on the ...
menu next to a filename, which will reveal something like
Choose "Copy url to clipboard" and use that instead.
Best,
ABK
12-06-2021 03:08 AM
I don' have the file in that place, can you please tell me how do I put it there?
12-06-2021 03:32 AM
Two options:
On the top-right corner of the project, use the "Add" button, which reveals a drop-down that includes an option to add a file...
Alternatively, drag-and-drop the file on the project name in the "Projects" sidebar...
-ABK
12-06-2021 04:50 AM
When I do that, the file goes to the folder but does not appear on here.
12-06-2021 05:02 AM
Hm.
Perhaps a refresh problem. Try restarting Neo4j Desktop.
12-06-2021 05:52 AM
I already try and nothing seems to work. I think I'm going to desinstall Neo4j and try again.
12-06-2021 07:10 AM
I change the settings to this:
dbms.directories.import = C:/
apoc.import.file.enabled=true
dbms.security.procedures.unrestricted=jwt.security.,apoc.,gds.,n10s.
And then, the path for this:
//Load_JSON_Country
CALL apoc.load.json("/Users/.Neo4jDesktop/relate-data/dbmss/dbms-1f5f63ad-bba8-4673-8d16-2a3bd7299f65/import/countries.json")
YIELD value
RETURN value
And it worked!
Thank you!
01-11-2022 04:21 AM
Facing same issue with Neo4j(4.3.1) and apoc(4.3.0.4) in neo4j Desktop
Also added the apoc.conf file in conf location
tried this
dbms.directories.import = C:/
apoc.import.file.enabled=true
dbms.security.procedures.unrestricted=jwt.security. ,apoc. ,gds. ,n10s.
And then, the path for this:
//Load_JSON_Country
CALL apoc.load.json("/Users/.Neo4jDesktop/relate-data/dbmss/dbms-1f5f63ad-bba8-4673-8d16-2a3bd7299f65/import/countries.json")
YIELD value
RETURN value
tried this CALL apoc.load.xml("file:///books.xml")
YIELD value
RETURN value
Anyone has any solution for this???
01-16-2022 08:20 AM
For windows, the simplest thing to do is to change the number of forward slashes to TWO forward slashes if you want to point to the default import directory. All the examples I followed had the following
# Either this with one forward slash
call apoc.import.csv([{fileName: 'file:/test_import.csv'}], [], {});
# Or this, with three forward slashes
call apoc.import.csv([{fileName: 'file:///test_import.csv'}], [], {});
# Neither worked for me and both (1 and 3) gave me the following error messages
Failed to invoke procedure apoc.import.csv: Caused by: java.io.IOException: Youre providing a directory outside the import directory defined into dbms.directories.import
# Two slashes worked
call apoc.import.csv([{fileName: 'file://test_export.csv'}], [], {});
I hope this helps!!
All the sessions of the conference are now available online