Reputation: 5954
I have a fresh build of neo4j-rest-graphdb-1.8-SNAPSHOT.jar . But I'm having trouble right out of the gate.
I have basic/default install of Neo4j running, configured with a valid graph store:
Neo4j Version
Graph Database Kernel 1.8.M05
OS
Ubuntu 12.04 LTS
Java version
"1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
A curl request suggests everything is working nicely:
$ curl http://localhost:7474/db/data/ -i
HTTP/1.1 200 OK
Content-Length: 809
Content-Encoding: UTF-8
Content-Type: application/json
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)
{
"extensions" : {
"CypherPlugin" : {
"execute_query" : "http://localhost:7474/db/data/ext/CypherPlugin/graphdb/execute_query"
},
"GremlinPlugin" : {
"execute_script" : "http://localhost:7474/db/data/ext/GremlinPlugin/graphdb/execute_script"
}
},
"node" : "http://localhost:7474/db/data/node",
"reference_node" : "http://localhost:7474/db/data/node/0",
"node_index" : "http://localhost:7474/db/data/index/node",
"relationship_index" : "http://localhost:7474/db/data/index/relationship",
"extensions_info" : "http://localhost:7474/db/data/ext",
"relationship_types" : "http://localhost:7474/db/data/relationship/types",
"batch" : "http://localhost:7474/db/data/batch",
"cypher" : "http://localhost:7474/db/data/cypher",
"neo4j_version" : "1.8.M05-1-ge9cdca9"
But, attempting the following line:
GraphDatabaseService graph = new RestGraphDatabase("http://localhost:7474/db/data/");
... produces an exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/core/Response$StatusType
at org.neo4j.rest.graphdb.RestAPIFacade.<init>(RestAPIFacade.java:265)
at org.neo4j.rest.graphdb.RestGraphDatabase.<init>(RestGraphDatabase.java:44)
at com.tester.api.Neo4j.importer(Neo4j.java:185)
at com.tester.api.Neo4j.main(Neo4j.java:97)
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Response$StatusType
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 4 more
Upvotes: 2
Views: 3127
Reputation: 485
I had the same problem and found out that I didn't have jersey. Tried to get all dependencies but didn't get this jar. so the solution can be.. Just download jersey-bundle-1.13-b01.jar.
P.S. : This might not be the best way to resolve it as there could be many dependencies but in this particular scenario it's only jersey which is missing so it works this way :-)
Upvotes: 1
Reputation: 5954
Okay, I think it finally all gelled for me:
From the top:
mvn dependency:copy-dependencies
to obtain copies of all the dependencies and then added them (the contents of target/dependency folder) to my build path (thanks Peter)mvn package
for another fresh/cloned/checked-out java-rest-binding git repo and copied the resultant .jar (neo4j-rest-graphdb-1.8-SNAPSHOT.jar
) into my project's lib (along with all the dependenciesI have done some preliminary tests and this appears to be working now!
If the above procedure shows my naivete with Maven and you know of a concise guide to avoiding such problems in the future, please share it!
Thanks!
Upvotes: 3
Reputation: 6331
This looks like a missing dependency. Have you made sure to include all the dependencies via maven, as stated in https://github.com/neo4j/java-rest-binding/blob/master/pom.xml ? You could build the project from source and pull down the deps for it by doing
mvn dependency:copy-dependencies
/peter
Upvotes: 2