cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

You're providing a directory outside the import directory defined into `dbms.directories.import`

Mariana
Node Clone

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 into dbms.directories.import

1 ACCEPTED SOLUTION

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!

View solution in original post

11 REPLIES 11

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?

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

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

Mariana
Node Clone

I don' have the file in that place, can you please tell me how do I put it there?

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...
3X_6_6_6672224d336959e0f5b008a47f17ed9d579d003a.png

Alternatively, drag-and-drop the file on the project name in the "Projects" sidebar...

3X_e_b_eb073ab29b52a113da2972f42942dc2777b8d6af.png

-ABK

When I do that, the file goes to the folder but does not appear on here.


Hm.

Perhaps a refresh problem. Try restarting Neo4j Desktop.

I already try and nothing seems to work. I think I'm going to desinstall Neo4j and try again.

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!

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???

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!!