2012-11-01 66 views
2

我正在使用CypersQueries從Java Applicaton創建節點。我按照上面的鏈接如何在Java中使用Neo4j的cyper查詢應用程序

http://docs.neo4j.org/chunked/milestone/query-create.html 

在我javaApplication我用一個簡單的查詢如上

public class CretaeQuery 
{ 
    public static final String DBPATH="D:/Neo4j/CQL"; 

    public static void main(String args[]) 
    { 
     GraphDatabaseService path=new EmbeddedGraphDatabase(DBPATH); 
     Transaction tx=path.beginTx(); 
     try 
     { 
     Map<String, Object> props = new HashMap<String, Object>(); 
     props .put("name", "Sharon"); 
     props .put("position", "Engineer"); 

     Map<String, Object> params = new HashMap<String, Object>(); 
     params.put("props", props ); 

     ExecutionEngine engine=new ExecutionEngine(path); 
     ExecutionResult result=engine.execute("create ({props})", params); 
     System.out.println(result); 
     tx.success(); 
     } 
     finally 
     { 
      tx.finish(); 
      path.shutdown(); 

     } 
    } 
} 

當我運行上面的類,我面對上述eror

Exception in thread "main" java.lang.NoClassDefFoundError: com/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap$Builder 
    at org.neo4j.cypher.internal.LRUCache.<init>(LRUCache.scala:30) 
    at org.neo4j.cypher.ExecutionEngine$$anon$1.<init>(ExecutionEngine.scala:84) 
    at org.neo4j.cypher.ExecutionEngine.<init>(ExecutionEngine.scala:84) 
    at com.neo4j.CretaeQuery.main(CretaeQuery.java:33) 
Caused by: java.lang.ClassNotFoundException: com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Builder 
    at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    ... 4 more 

我不知道爲什麼錯誤是拋出。請用適當的代碼給我建議

回答

1

您的類路徑中缺少東西,或者服務器未正確初始化。在大約一個月前,併發的映射被放在/ lib中。這是嵌入式模式還是服務器模式?

+0

嗨,我在類路徑中缺少的jar。我在Windows 32位中使用neo4j-community-1.9-SNAPSHOT.zip。 – Navyah

+0

嵌入式模式還是REST? –

+0

它在嵌入式模式 – Navyah

相關問題