在 Cypher + Neo4j 中加载 CSV 失败“LoadExternalResourceException:无法加载外部资源:" [英] Load CSV Fails in Cypher + Neo4j "LoadExternalResourceException: Couldn't load the external resource at:"

查看:23
本文介绍了在 Cypher + Neo4j 中加载 CSV 失败“LoadExternalResourceException:无法加载外部资源:"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行 Ubuntu 14.04 的企业云服务器上全新安装了 Neo4j 2.1.4 开源.我正在将 CSV 文件导入数据库.我的文件的路径是'/home/username/data-neo4j/node.csv'

I have a fresh install of Neo4j 2.1.4 open source on a corporate cloud server running Ubuntu 14.04. I am importing a CSV file into the database. The path to my file is '/home/username/data-neo4j/node.csv'

以下是我从 Neo4j 命令行工具 neo4j-shell 运行的命令:

Below is my command, which I run from the Neo4j command line tool neo4j-shell:

从file:///home/username/data-neo4j/node.csv"中加载带有标题的 CSV 作为行 CREATE (:Node { nid: toInt(line.nid), title: line.title, type: line.type, url: line.url});

返回:

LoadExternalResourceException:无法加载外部资源:file:/home/user/data-neo4j/node.csv

这看起来像是一条消息,说它找不到文件.但是,该文件已就位.我什至尝试将文件的权限更改为 755.

This looks like a message saying it can't find the file. However, the file is in place. I even tried changing the permissions on the file to be 755.

我在本地机器上有一个单独的 Neo4j 实例(OSX with Neo4j 2.1.2 Enterprise).鉴于我切换路径以匹配,该命令在我的本地机器上成功.

I have a separate instance of Neo4j on my local machine (OSX with Neo4j 2.1.2 Enterprise). The command is successful on my local machine, given that I switch the path to match.

我在运行 neo4j-shell 时注意到的一件事,我得到 注意:端口 1337 处的远程 Neo4j 图形数据库服务shell".我已打开此端口,但我的命令仍返回相同的错误消息.

One thing I notice when I run neo4j-shell, I get NOTE: Remote Neo4j graph database service 'shell' at port 1337. I have opened this port and my command still returns the same error message.

我也通读了这个链接 - 但他们的问题是他们没有上传他们的文件.我的文件就位.

I also read through this link - but their problem was that they had not uploaded their file. My file is in place.

neo4j LOAD CSV 返回无法加载外部资源

推荐答案

sheldonkreger,你的同事是对的.感谢他.

sheldonkreger, your co-worker is right. Thanks to him.

我用同样的方法解决了这个问题,但实际上你不需要将文件放在 neo4j 用户具有权限的位置,如他所建议的,例如/var/log/neo4j 或/var/lib/neo4j.

I solved it doing the same, but you actually don't need to place the file in a location where neo4j user has permissions, as suggested by him, for example /var/log/neo4j or /var/lib/neo4j.

相反,只需转到上面提到的 neo4j 目录并查看那里的文件权限,并为您的 csv 文件或您尝试导入的任何文件提供相同的权限.

Instead, just go to the neo4j directories mentioned above and see the file permissions over there, and provide the same permissions to your csv file or whichever file you are trying to import.

例如,对于我的系统,neo4j 文件夹中的文件权限是这样的:

For example, for my system the file permissions in neo4j folder was like this:

ls -la
total 208
drwxr-xr-x  4 neo4j adm    4096 Feb  4 10:35 .
drwxr-xr-x 87 root  root   4096 Feb 11 22:21 ..
drwxr-xr-x  3 neo4j adm    4096 Feb  4 10:35 bin
-rw-r--r--  1 neo4j adm   61164 Jan 29 22:32 CHANGES.txt
lrwxrwxrwx  1 neo4j adm      10 Sep 30 12:07 conf -> /etc/neo4j
drwxr-xr-x  4 neo4j adm    4096 Mar 13 13:25 data
lrwxrwxrwx  1 neo4j adm      20 Sep 30 12:07 lib -> /usr/share/neo4j/lib
-rw-r--r--  1 neo4j adm  125517 Jan 29 22:32 LICENSES.txt
lrwxrwxrwx  1 neo4j adm      24 Sep 30 12:07 plugins -> /usr/share/neo4j/plugins
-rw-r--r--  1 neo4j adm    1568 Jan 29 22:32 README.txt
lrwxrwxrwx  1 neo4j adm      23 Sep 30 12:07 system -> /usr/share/neo4j/system
-rw-r--r--  1 neo4j adm    4018 Jan 29 22:30 UPGRADE.txt

所以我对我的文件做了同样的事情,neo4j 成功地运行了导入命令.

So I did the same to my file and neo4j was successfully able to run the import command.

我是这样做的:

sudo chown neo4j:adm <csv file location>

这篇关于在 Cypher + Neo4j 中加载 CSV 失败“LoadExternalResourceException:无法加载外部资源:"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆