Neo4j Java Rest绑定:NoClassDefFoundError
我有一个新版本的neo4j-rest-graphdb-1.8-SNAPSHOT.jar。但我一出门就有麻烦了 我已运行Neo4j的基本/默认安装,并配置了有效的图形存储: Neo4j版本 图形数据库内核1.8.M05 OS Ubuntu 12.04 LTS Java版本 “1.6.0_24” OpenJDK运行时环境(IcedTea6 1.11.1)(6b24-1.11.1-4ubuntu3) OpenJDK 64位服务器虚拟机(构建20.0-b12,混合模式) 卷发请求表明一切正常:Neo4j Java Rest绑定:NoClassDefFoundError,java,rest,graph,neo4j,Java,Rest,Graph,Neo4j,我有一个新版本的neo4j-rest-graphdb-1.8-SNAPSHOT.jar。但我一出门就有麻烦了 我已运行Neo4j的基本/默认安装,并配置了有效的图形存储: Neo4j版本 图形数据库内核1.8.M05 OS Ubuntu 12.04 LTS Java版本 “1.6.0_24” OpenJDK运行时环境(IcedTea6 1.11.1)(6b24-1.11.1-4ubuntu3) OpenJDK 64位服务器虚拟机(构建20.0-b12,混合模式) 卷发请求表明一切正常: $ cu
$ 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"
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
但是,尝试以下行:
$ 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"
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
GraphDatabaseService图形=新的RestGraphDatabase(“http://localhost:7474/db/data/");
。。。生成异常:
$ 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"
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
线程“main”java.lang.NoClassDefFoundError中的异常:javax/ws/rs/core/Response$StatusType
位于org.neo4j.rest.graphdb.RestAPIFacade(RestAPIFacade.java:265)
位于org.neo4j.rest.graphdb.RestGraphDatabase。(RestGraphDatabase.java:44)
位于com.tester.api.Neo4j.importer(Neo4j.java:185)
位于com.tester.api.Neo4j.main(Neo4j.java:97)
原因:java.lang.ClassNotFoundException:javax.ws.rs.core.Response$StatusType
位于java.net.URLClassLoader$1.run(URLClassLoader.java:202)
位于java.security.AccessController.doPrivileged(本机方法)
位于java.net.URLClassLoader.findClass(URLClassLoader.java:190)
位于java.lang.ClassLoader.loadClass(ClassLoader.java:306)
位于sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
位于java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 4更多
这看起来像是缺少依赖项。您是否确保通过maven包含所有依赖项,如中所述?您可以从源代码构建项目,并通过
mvn dependency:copy-dependencies
/彼得好吧,我想我终于明白了: 从顶部开始:
mvn dependency:copy dependencies
来获取所有依赖项的副本,然后将它们(目标/依赖项文件夹的内容)添加到我的构建路径中(谢谢Peter)mvn包
,并将结果.jar(neo4j-rest-graphdb-1.8-SNAPSHOT.jar
)复制到我的项目库中(以及所有依赖项)谢谢!我也遇到了同样的问题,发现我没有jersey。尝试获取所有依赖项,但没有获取此jar。因此解决方案可以是..只需下载jersey-bundle-1.13-b01.jar
备注:这可能不是解决此问题的最佳方法,因为可能存在许多依赖项,但在这个特定场景中,它是唯一缺少的jersey,因此它是这样工作的:-)谢谢Peter,我尝试了此方法,但不起作用(相同的错误)。它构建,然后我将jar文件复制到项目的lib文件夹中。构建路径中的其他jar有:geronimo-jta_1.1_spec-1.1.1.jar、json-simple-1.1.1.jar、lucene-core-3.5.0.jar、mysql-connector-java-5.0.8-bin.jar、neo4j-cypher-1.8.M05.jar、neo4j-graph-algo-1.8.M05.jar、neo4j-graph-matching-1.8.M05.jar、neo4j-jmx-1.8.8.M05.jar、neo4j-neo4j-jx-jx-1.05、neo8.05、neo4j-m8.05.05、neo4j-m8.jar-m01.05、neo8.05.jar-m8.jar-mj,neo4j-udc-1.8.M05.jar,org.apache.servicemix.bundles.jline-0.9.94_1.jar,scala-library-2.9.1-1.jar,server-api-1.8.M05.jar引用自neo4j集团(来自Peter):这很有效,但你很幸运。将所有JAR打包到一个JAR中可能会覆盖在不同输入JAR中相同位置下具有不同内容的文件,如java service loader文件。您没有这些,但请注意,如果您包括e。G注册更多缓存类型的内核和企业JAR。