Hi,
I am upgrading the Neo4j JDBC driver to 2.3.2 but run into the following
error in the log. Along with the relevent code/settings, here are the
details.
This code works for Neo4j JDBC 2.0.3 connecting to a standalone Neo4j
server.
Thanks in advance.
Rick
My code:
try ( Connection conn = dataSource.getConnection() )
{
// SET n = { ... } wipes out all old properties
String cypher = "MERGE (n:" + neo4jNode.label + "{" + neo4jNode.idName
+":{1}}) SET n = {2} RETURN count(n)"; // need index to perform better
logger.info("create node cypher=" + cypher);
PreparedStatement ps = conn.prepareStatement(cypher);
ps.setObject(1, neo4jNode.idValue);
Map<String, Object> props = new HashMap<>(neo4jNode.props);
props.put(neo4jNode.idName, neo4jNode.idValue);
ps.setObject(2, props);
logger.info("parameter: {}, {}", neo4jNode.idValue, props);
ResultSet rs = ps.executeQuery();
rs.next();
int count = rs.getInt(1);
logger.info("created number of nodes=" + count);
if (count > 1)
throw new Neo4jException("node id value: " + neo4jNode.idValue + " with
label: " +
neo4jNode.label + " is not unique in the database");
return count;
}
catch (Exception ex)
{
throw new Neo4jException(ex);
}
The log is:
2016-04-01 14:07:55,476 178 [main] INFO com.zaxxer.hikari.HikariDataSource -
HikariPool-1 - Started.
2016-04-01 14:07:56,632 1334 [HikariPool-1 housekeeper] DEBUG
com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=0,
active=0, idle=0, waiting=0)
2016-04-01 14:07:56,647 1349 [HikariPool-1 connection adder] DEBUG
com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection
org.neo4j.jdbc.Neo4jConnection@66f92b3c
2016-04-01 14:07:56,651 1353 [main] INFO c.n.f.s.t.n.c.t.Neo4jNodeTemplateJdbc
- create node cypher=MERGE (n:Test{myId:{1}}) SET n = {2} RETURN count(n)
2016-04-01 14:07:56,657 1359 [main] INFO c.n.f.s.t.n.c.t.Neo4jNodeTemplateJdbc
- parameter: testId1, {dummy=abc, myId=testId1}
java.lang.NoSuchMethodError:
scala.Predef$.$conforms()Lscala/Predef$$less$colon$less;
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:114)
at
org.neo4j.cypher.javacompat.internal.ServerExecutionEngine.executeQuery(ServerExecutionEngine.java:62)
at
org.neo4j.kernel.impl.factory.GraphDatabaseFacade.execute(GraphDatabaseFacade.java:333)
at
org.neo4j.jdbc.embedded.EmbeddedQueryExecutor.executeQuery(EmbeddedQueryExecutor.java:58)
at org.neo4j.jdbc.Neo4jConnection.executeQuery(Neo4jConnection.java:363)
at
org.neo4j.jdbc.Neo4jPreparedStatement.executeQuery(Neo4jPreparedStatement.java:46)
at
com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at
com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
.....
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
The relevant dependencies are:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-jdbc</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.4.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId>
<version>2.3.3</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-io</artifactId>
<version>2.3.3</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
The JDBC setting is:
<bean id="neo4jDataSource" class="com.zaxxer.hikari.HikariDataSource"
destroy-method="close">
<property name="username" value=""/>
<property name="password" value=""/>
<property name="jdbcUrl" value="jdbc:neo4j:mem:mydb"/>
<property name="driverClassName" value="org.neo4j.jdbc.Driver"/>
<property name="maximumPoolSize" value="1"/>
<property name="minimumIdle" value="1"/>
</bean>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.