2016-08-30 19 views
0

以下代码片段尝试连接到Graph并对其执行一些操作。它旨在使用Graph的DSE Java驱动程序1.1运行。来自Java的DSE图形 - 无法访问DelegatingCluster

import com.datastax.driver.dse.graph.GraphStatement; 
import com.datastax.driver.dse.graph.SimpleGraphStatement; 
import com.datastax.driver.dse.DseCluster; 
import com.datastax.driver.dse.DseSession; 

public class GraphTest { 

    public static void main(String[] args) { 
     System.out.println("Start..."); 

     DseCluster dseCluster = DseCluster.builder() 
        .addContactPoint("127.0.0.1") 
        .build(); 
     DseSession dseSession = dseCluster.connect();dseSession.executeGraph("system.graph('demo').ifNotExists().create()"); 

     GraphStatement s1 = new SimpleGraphStatement("g.addV(label, 'test_vertex')").setGraphName("demo");  
     dseSession.executeGraph(s1); 

     GraphStatement s2 = new SimpleGraphStatement("g.V()").setGraphName("demo");   
     GraphResultSet rs = dseSession.executeGraph(s2); 

     System.out.println(rs.one().asVertex()); 
     System.out.println("End."); 
    } 
} 

然而,编译提供了以下错误:

javac -cp .\dse-driver-1.1.0.jar GraphTest.java

GraphTest.java:12: error: cannot access DelegatingCluster DseCluster dseCluster = DseCluster.builder() ^ class file for com.datastax.driver.core.DelegatingCluster not found GraphTest.java:16: error: cannot access Session DseSession dseSession = dseCluster.connect();dseSession.executeGraph("system.graph('demo').ifNotExists().create()"); ^ class file for com.datastax.driver.core.Session not found GraphTest.java:22: error: cannot find symbol GraphResultSet rs = dseSession.executeGraph(s2); ^ symbol: class GraphResultSet location: class GraphTest 3 errors

它看起来像访问类建立会话不对劲。这里有什么遗漏吗?

回答