运行 neo4j DriverManager.getConnection 在 linux 时发出

Issue while running neo4j DriverManager.getConnection in linux

我正在尝试连接到 neo4j 远程服务器....如果我 运行 通过 windows 我的代码工作正常......但是当我将它作为 运行nable jar 并尝试在我的 centos 中 运行 它抛出错误...

            String line="060100B075|MOC|20150407|16:28:23|81|0628001735";       
            String[] cols = line.split("\|");
            nodeCreation.createNodes(cols[0],cols[1],cols[2]);

//创建节点函数

            Connection con= DriverManager.getConnection("jdbc:neo4j://144.35.78.234:7474/");
            String Query = "MERGE (ABC:PLANE {name: " + "\""
                            + cols[0]+ "\"" + " }) RETURN ABC";
          try (PreparedStatement stmt = con.prepareStatement(Query)) {
            ResultSet RS = stmt.executeQuery();
        }

我能够从 window 连接并能够从 window..但不能从 linux 环境插入节点..我认为我的代码没有任何问题。 .我该如何解决..

如下错误片段:

Apr 14, 2015 6:41:19 PM org.restlet.engine.connector.ClientConnectionHelper start
INFO: Starting the internal [HTTP/1.1] client
Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.jackson.JsonNode.asText()Ljava/lang/String;
        at org.neo4j.jdbc.internal.rest.Resources$DiscoveryClientResource.readInformation(Resources.java:153)
        at org.neo4j.jdbc.internal.rest.Resources.getDiscoveryResource(Resources.java:61)
        at org.neo4j.jdbc.internal.Neo4jConnection.createExecutor(Neo4jConnection.java:109)
        at org.neo4j.jdbc.internal.Neo4jConnection.<init>(Neo4jConnection.java:79)
        at org.neo4j.jdbc.internal.Connections.doCreate(Connections.java:65)
        at org.neo4j.jdbc.internal.Connections.create(Connections.java:80)
        at org.neo4j.jdbc.Driver.connect(Driver.java:80)
        at org.neo4j.jdbc.Driver.connect(Driver.java:42)
        at java.sql.DriverManager.getConnection(DriverManager.java:571)
        at java.sql.DriverManager.getConnection(DriverManager.java:233)
        at com.emc.neo4jConnectivity.Test1.createNodes(Test1.java:39)
        at com.emc.neo4jConnectivity.HiveToNeo4jRemoteServer.main(HiveToNeo4jRemoteServer.java:48)
        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:606)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

这是我的 pom.xml 的样子:

<dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j</artifactId>
        <version>2.1.7</version>
  </dependency>
     <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-jdbc</artifactId>
      <version>2.0.2</version>
    </dependency>
  <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-client</artifactId>
        <version>2.4.0</version>
    </dependency>

尝试分享mvn dependency:tree, 可能是您的 hadoop 库引入了不同的版本。

另请了解准备语句中的参数并使用stmt.executeUpdate()

  Connection con=
    DriverManager.getConnection("jdbc:neo4j://144.35.78.234:7474/");
  String query = "MERGE (plane:Plane {name: {1}}) RETURN plane";
  try (PreparedStatement stmt = con.prepareStatement(query)) {
    stmt.setString(1,cols[0]);
    stmt.executeUpdate();
  }