· neo4j apoc

Neo4j: APOC - Caused by: java.io.RuntimeException: Can't read url or key file (No such file or directory)

I’ve been using Neo4j’s APOC library to load some local JSON files this week, and ran into an interesting problem.

The LOAD CSV tool assumes that any files you load locally are in the import directory, so I’ve got into the habit of putting my data there. Let’s check what I’m trying to import by opening the import directory:

import directory

What’s in there?

import directory contents

Just the one JSON file needs processing. If we want to import local files we need to add the following property to our Neo4j configuration file:


If you’re using the Neo4j Desktop, you can add this property via the 'Settings' tab:

Selection 142

Once we’ve done that we’ll need to restart the database so our new settings will be picked up:

restart after config

Now let’s try to process our JSON file:

neo4j> CALL apoc.load.json("file:///dummy.json");
Failed to invoke procedure `apoc.load.json`: Caused by: java.lang.RuntimeException: Can't read url or key file:/dummy.json as json: /dummy.json (No such file or directory)

Hmm, that didn’t work as we expected - it seems to be trying to read the file from the root of the machine rather than from the import directory. It turns out I hadn’t RTFM:

local files

Let’s update our Neo4j configuration file to add the following property:


If we re-run our query we’ll see that it now finds and processes the file:

load json
  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket