1

I'm attempting to get the ETL loader to work on OrientDB 2.2.5 on an OSX machine (10.11.6) but I keep getting a FileNotFoundException on the input JSON file...

I'm going off the example that can be found in the tutorials for the post.csv and post.json files. I modified them to remove the paths since those don't align with my own path structure very well.

Here's my post.csv:

id,title
10,NoSQL movement
20,New Orientdb

The post.json file:

{
  "source": { "file": { "path": "post.csv" } },
  "extractor": { "csv": {} },
  "transformers": [
    { "vertex": { "class": "Post" } }
  ],
  "loader": {
    "orientdb": {
       "dbURL": "plocal:dbtest",
       "dbType": "graph",
       "classes": [
         {"name": "Post", "extends": "V"},
         {"name": "Comment", "extends": "V"},
         {"name": "HasComments", "extends": "E"}
       ], "indexes": [
         {"class":"Post", "fields":["id:integer"], "type":"UNIQUE" }
       ]
    }
  }
}

I have the environment variable ORIENTDB_HOME set up to the location where orientdb-community-2.2.4 is, and $ORIENTDB_HOME/bin is in my path.

If I enter the following:

$ oetl.sh post.json

The output is this:

OrientDB etl v.2.2.4 (build 2.2.x@rf5282664db9300ef3358fb4d7e2066ad418c2e61; 2016-07-08 12:30:59+0000) www.orientdb.com
Exception in thread "main" com.orientechnologies.orient.core.exception.OConfigurationException: Error on loading config file: post.json
    at com.orientechnologies.orient.etl.OETLProcessor.parseConfigAndParameters(OETLProcessor.java:131)
    at com.orientechnologies.orient.etl.OETLProcessor.main(OETLProcessor.java:108)
Caused by: java.io.FileNotFoundException: post.json (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at com.orientechnologies.common.io.OIOUtils.readFileAsString(OIOUtils.java:140)
    at com.orientechnologies.orient.etl.OETLProcessor.parseConfigAndParameters(OETLProcessor.java:120)
    ... 1 more

I'm not sure what the right fix is... my issue seems similar to another previously asked question, but the fix for that hasn't worked for me since I don't have spaces in any paths. I've tried setting up absolute paths in the configuration file but that's not changed anything.

I am running oetl.sh from the directory where my posts.json and posts.csv files are located, but it still seems unable to find posts.json.

Update: Both files (posts.json, posts.csv) are colocated in the same directory. I have tried running oetl.sh as well as just oetl.sh posts.json, but the exception keeps happening. I've also tried editing the posts.json so that it also has full absolute paths in it and that does not change the result.

Any help would be greatly appreciated... I think it's probably some kind of java configuration issue, but I'm relatively new with Java so I may have missed some environment variable or something?

Community
  • 1
  • 1
TxAG98
  • 1,070
  • 2
  • 10
  • 25

1 Answers1

2

I think I have it worked out... adding the answer for archival purposes.

I had the orientdb-community-2.2.4/bin directory in my PATH, and was trying to run from the directory that contains my post.json and post.csv.

The first thing that oetl.sh script changes its working directory to the scripts location:

#!/bin/sh
#
# Copyright (c) 2014 Luca Garulli 
#

#set current working directory
cd `dirname $0`

...

So, when oetl.sh executes the actual java code, its using the working directory $ORIENTDB_HOME/bin rather than the current working directory from the user's shell. This means the post.json file must be specified with its absolute path on the command line. Also, the post.csv file listed inside the post.json file also needs to have its absolute path.

I can comment out the cd dirname $0 line and the script works fine, so I'm not sure what the value of that line really is in the script. /shrug

TxAG98
  • 1,070
  • 2
  • 10
  • 25