After upgrading from Neo4j 2.2.5 to Neo4j 2.3.1 on Windows Server 2012 R2 with Java 8.45, we encountered a problem with file handles. When running the command shown at the bottom of this post using either the web interface or neo4jshell.bat, the cypher completes successfully and a process monitor trace confirms that Java successfully closed the file. However, I am unable to move that csv file because the file is open in another process. Handle.exe confirms that Java still has a read-write handle on that file.
When I run the same process against a Neo4j 2.2.5 graph on the same machine with the same file, Java does not retain the read-write handle on the csv file. We will need to revert to 2.2.5 until this issue is resolved. The only application change we made during the upgrade from 2.2.5 to 2.3.1 was to accommodate the new file reference format (file:///x://filename.csv vs. file:x:/filename.csv).
Are there other actions we can take short of restarting the service or stopping and starting the drive to force Java to close this file? I understand that Neo4jShell.bat is deprecated in favor of the powershell commands, but ultimately the issue is that Java is retaining the file handle, so changing the method of delivering the cypher command can't improve the way Java is handling the csv file. I've run the same cypher from both the web interface and neoj4shell.bat and gotten the same result.
USING PERIODIC COMMIT 3000
LOAD CSV WITH HEADERS
FROM "file:///x://filename.csv"
AS line
MATCH (a:node {id : line.id}), (b:othernode {id : line.other_id})
WITH a, b
WHERE shortestPath((a)-[:PREVIOUS]->(b)) is null
CREATE (a)-[:PREVIOUS]->(b);
Related
I'm trying to install the APOC Full jar file (4.2.0.6) to my Neo4J instance that's running in a Google Compute VM. To do so, I've installed the JAR file from GitHub releases to the /plugins folder. Each time I restart or run the environment it crashes with the following output to logs:
"Some jar procedure files (apoc-4.2.0.6-all.jar) are invalid, see log for details."
There's really no additional details provided...
If I copy the default APOC Core library found withing /labs, it works. I've tried to download this same file from Github and it fails. I've verified that the same user/group permissions are applied to the downloaded file as well.
Any ideas?
This usually happens for two reasons:
First is version mismatch. You can check which version you should use based on the version matrix, which is available at: https://github.com/neo4j-contrib/neo4j-apoc-procedures#version-compatibility-matrix. Unfortunately, it is not always up to date, but the APOC versions are if I understand correctly:
APOC 4.1.x.x -> Neo4j 4.1.x
APOC 4.2.x.x.-> Neo4j 4.2.x
APOC 4.3.x.x -> Neo4j 4.3.x
If I had to guess, you are probably using Neo4j 4.3 or 4.1 and using an APOC that is designed to work with Neo4j 4.2.
The other issue is that sometimes you have multiple APOC plugin files in the plugin folders, so that will also crash Neo4j.
I have been using Neo4j for several months now and am getting pretty exasperated.
It appears that every new version breaks the previous one.
I have multiple Cypher Load scripts that I can no longer run via the command line.
I can run the following from the Browser:
USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "file:///person.csv" AS csvLine
MERGE (p:Person {sysurn : csvLine.urn})
ON CREATE SET p.dob = trim(csvLine.dob)
ON CREATE SET p.forename = trim(csvLine.forename)
ON CREATE SET p.surname = trim(csvLine.surname );
Previously in version 3.0.3 (Community Edition) I ran the following:
java -cp "C:\Program Files\Neo4j CE 3.0.3\bin\neo4j-desktop-3.0.3.jar" org.neo4j.shell.StartClient -file "D:/nosql/Load data/load_person.cql"
This no longer works in 3.1.1:
java -cp "C:\Program Files\Neo4j CE 3.1.1\bin\neo4j-desktop-3.1.1.jar" org.neo4j.shell.StartClient -file "D:/nosql/Load data/load_person.cql"
I get a Java Error. The general consensus is to run the full .tar version, so I installed that.
I can now run the Cypher from the browser or using cypher-shell. However this is of no use as there is no way to call an external script, so I have to do this for possibly hundreds of scripts.
Recommendation is to use ne04j-shell (now deprecated!)
I try neo4j-shell. This doesn't accept spaces in the path!
I move the file and try to run the following:
"C:\Program Files\neo4j-community-3.1.1\bin\neo4j-shell" -path "D:/nosql/neoDB/databases/graph.db" -config "neo4j.conf" -file "D:/nosql/Loaddata/load_person.cql"
I get the following error:
ERROR (-v for expanded information):
Error starting org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory,
D:\nosql\neoDB\databases\graph.db
I have tried various combinations including adding the host name as prompted:
non-JRMP server at remote endpoint
I try adding the -config param, however this again doesn't allow spaces!
With every new version it seems to get more difficult to actually import data into Neo4j.
My question is, Is it possible in version 3.1.1 to run more than one cypher script at a time without manually running every one?
Is it possible to use neo4j-shell in version 3.1.1?
Try using the APOC procedure apoc.cypher.runFile from within cypher-shell. Here is an example (with a file URL formatted for Windows):
CALL apoc.cypher.runFile("file:d:/nosql/Load data/load_person.cql");
If the space in the path still presents problems, you could rename the "Load data" folder to "LoadData" and modify the above query accordingly.
Well I have managed to find a workaround.
Install neo4j 3.1.1
Create a database
Uninstall Neo4j
Install neo4j 3.0.8
Run my Cypher scripts
e.g. java -cp "C:\Program Files\Neo4j CE
3.0.8\bin\neo4j-desktop-3.0.8.jar" org.neo4j.shell.StartClient -file "D:/nosql/Load data/load_person.cql"
uninstall neo4j
install neo4j 3.1.1
I don't think this is going to cut it in a production environment though :)
I'm trying to create an unmanaged extension using this. I'm currently using a Windows environment
Now, I followed everything and here is what my pom file looks now:
POM
and here is my java class containing the unmanaged extension
HelloWorldResource
Now, I tried to run "**mvn clean package**", and it produced a jar file around 10MB which I then put into the plugins folder of my database.
When I start the server, the following error always appears:
Starting Neo4j failed:
org.neo4j.server.web.NeoServletContainer-49fd135#9bfd861c==org.neo4j.server.web.NeoServletContainer,-1,false
The log file is not useful as it doesn't show any exception that cause the it. Other people also reported the issue in stack overflow and appears to be a jar issue. What else could I have missed?
Neo4j fails to start
Neo4j fails in startup
PS: I'm using 3.0.3 Neo4j Community Edition.
I have an instance in AWS hosting a Neo4j DB.
The version im using is 2.3.1.
I backed it up using "neo4j-backup".
I then zipped the files and uploaded to an external storage.
I wanted to restore the DB to another instance I have using the same version (2.3.1), so I copied the files to the same folder the 1st instance is using.
When I run the neo4j console command it states:
ERROR Neo4j cannot be started, because the database files require upgrading and upgrades are disabled in configuration. Please set 'allow_store_upgrade' to 'true' in your configuration file and try again.
Of course the "allow_store_upgrade" is commented out,
Do I have to do the upgrade when restoring?
How can I find the DB version?
If you're using the same version you shouldn't need to comment it out. Though I don't think it would harm anything if you do (especially if you still have that backup somewhere else).
You should be able to find the version of Neo4j in the CHANGES.txt / README.txt files. It should also output the version in data/graph.db/messages.log when you start up the server. Also if you go to the web console (at http://localhost:7474 by default) it will show you the version.
I have created nodes and relationships in java using Neo4j jars,I am trying to display the same from Neoclipse,
I am getting Exception when trying to create connection from Neoclipse to the folder created by java program (I am using windows 7) .
Exception:
java.lang.IllegalStateException:Mismatching store version found(v0.A.1 while expecting v0.A.0)
and the store is not cleanly shutdown.
Recover the database with previous database version and then attempt to upgrade .
after this i added graphDb.shutdown(); code then i got different exception:
org.neo4j.kernel.impl.storemigration.StoreUpgrader$UnableToUpgradeException:
Not all store Files match the version required for successful upgrade.
List of jar Files:
geronimo-jta_1.1_spec-1.1.1.jar
lucene-core-3.6.2.jar
neo4j-2.0.1.jar
neo4j-cypher-2.0.1.jar
neo4j-graph-algo-2.0.1.jar
neo4j-graph-matching-2.0.1.jar
neo4j-jmx-2.0.1.jar
neo4j-kernel-2.0.1.jar
neo4j-lucene-index-2.0.1.jar
neo4j-udc-2.0.1.jar
Please guide me.
It looks like you've created your datastore with Neo4j 2.0.1. Neoclipse seems to use an earlier version. Datastore downgrades are not supported.
However you could drop your database into a Neo4j 2.0.1 server and connect to it remotely using Neoclipse.