在Cypher + Neo4j中加载CSV失败“LoadExternalResourceException:Could not load the external resource at:” [英] Load CSV Fails in Cypher + Neo4j "LoadExternalResourceException: Couldn't load the external resource at:"

查看:2771
本文介绍了在Cypher + Neo4j中加载CSV失败“LoadExternalResourceException:Could not load the external resource at:”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行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:

LOAD CSV WITH HEADERS FROMfile:///home/username/data-neo4j/node.csvAS行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时,我得到注意:远程Neo4j图形数据库服务'shell'在端口1337 。我已经打开这个端口,我的命令仍然返回相同的错误消息。

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 returns Could not Load external resource

推荐答案

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目录,

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成功地运行了import命令。

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:Could not load the external resource at:”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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