2013-07-26 82 views
1

與Neo4j的Java的休息,綁定APINeo4j的休息API不工作

git clone https://github.com/neo4j/java-rest-binding 
mvn clean package 

然後得到了我的JAR有問題。

嘗試這樣:

import org.neo4j.rest.graphdb.RestAPI; 
import org.neo4j.rest.graphdb.RestAPIFacade; 
import org.neo4j.rest.graphdb.entity.RestNode; 
import org.neo4j.rest.graphdb.query.RestCypherQueryEngine; 
import org.neo4j.rest.graphdb.util.QueryResult; 
import static org.neo4j.helpers.collection.MapUtil.map; 

import java.util.Map; 

public class Connect { 
    public static void main(String[] args) { 
     System.out.println("starting test"); 
     RestAPI api = new RestAPIFacade("http://localhost:7474/"); 
     System.out.println("API created"); 
     final RestCypherQueryEngine engine = new RestCypherQueryEngine(api); 
     System.out.println("engine created"); 

     QueryResult<Map<String,Object>> result = engine.query("start n=node({id}) return n", map("id",1)); 

     System.out.println("query created"); 
     System.out.println(result); 


    for (Map<String, Object> row : result) { 
     Object tagline = row.get("tagline"); 
     long id=((Number)row.get("id")).longValue(); 
     System.out.println("id is " + id); 
     System.out.println(row.get("myRow")); 
     } 
    } 
} 

添加了Neo4j的休息和嵌入式庫,並得到該錯誤消息。 (順便說一句我已經確認並有一個節點1和服務器在本地運行)

開始測試

Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/core/Response$StatusType 
at org.neo4j.rest.graphdb.RestAPIFacade.<init>(RestAPIFacade.java:294) 
at Connect.main(Connect.java:20) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:601) 
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) 
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Response$StatusType 
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:423) 
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:356) 
... 7 more 

任何想法?

回答

1

你可能會有一堆瓶子作爲依賴包含在內。 包括其餘的行家依賴結合當然會照顧它:


org.neo4j
Neo4j的休息,graphdb
1.8.1

如果您已經從建源,那麼我通常會做不科學的事情,看看pom.xml https://github.com/neo4j/java-rest-binding/blob/master/pom.xml並從/ target/dependencies中挑選依賴關係

1

您可以在src build

mvn dependency:copy-dependencies 

它將把所有的依賴到

ls target/dependency