我有一个全新的 neo4j-rest-graphdb-1.8-SNAPSHOT.jar 版本。但是我一出门就遇到了麻烦。
我运行了 Neo4j 的基本/默认安装,并配置了有效的图形存储:
Neo4j 版本
图数据库内核 1.8.M05
操作系统
Ubuntu 12.04 LTS
爪哇版
"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)
curl 请求表明一切正常:
$ 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"
但是,尝试以下行:
GraphDatabaseService graph = new RestGraphDatabase("http://localhost:7474/db/data/");
...产生一个异常:
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