NoSuchMethodError:org.neo4j.driver.v1.Driver.session

时间:2018-01-10 08:47:00

标签: spring-data-neo4j neo4j-ogm liquigraph

在将LiquiGraph引入我的Spring Data Neo4j应用程序后,我遇到了以下问题:

Caused by: java.lang.NoSuchMethodError: org.neo4j.driver.v1.Driver.session(Lorg/neo4j/driver/v1/AccessMode;Ljava/lang/Iterable;)Lorg/neo4j/driver/v1/Session;
    at org.neo4j.ogm.drivers.bolt.driver.BoltDriver.newSession(BoltDriver.java:157) ~[neo4j-ogm-bolt-driver-3.0.1.jar!/:na]
    at org.neo4j.ogm.drivers.bolt.driver.BoltDriver.newTransaction(BoltDriver.java:86) ~[neo4j-ogm-bolt-driver-3.0.1.jar!/:na]
    at org.neo4j.ogm.session.transaction.DefaultTransactionManager.openTransaction(DefaultTransactionManager.java:70) ~[neo4j-ogm-core-3.0.1.jar!/:na]
    at org.neo4j.ogm.session.transaction.DefaultTransactionManager.openTransaction(DefaultTransactionManager.java:56) ~[neo4j-ogm-core-3.0.1.jar!/:na]
    at org.neo4j.ogm.drivers.bolt.request.BoltRequest.executeRequest(BoltRequest.java:148) ~[neo4j-ogm-bolt-driver-3.0.1.jar!/:na]
    at org.neo4j.ogm.drivers.bolt.request.BoltRequest.execute(BoltRequest.java:87) ~[neo4j-ogm-bolt-driver-3.0.1.jar!/:na]
    at org.neo4j.ogm.autoindex.AutoIndexManager.validateIndexes(AutoIndexManager.java:137) ~[neo4j-ogm-core-3.0.1.jar!/:na]
    at org.neo4j.ogm.autoindex.AutoIndexManager.build(AutoIndexManager.java:96) ~[neo4j-ogm-core-3.0.1.jar!/:na]
    at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:84) ~[neo4j-ogm-core-3.0.1.jar!/:na]
    at com.decisionwanted.domain.configuration.Neo4jConfig.sessionFactory(Neo4jConfig.java:42) ~[domain-0.0.1.jar!/:0.0.1]
    at com.decisionwanted.domain.configuration.Neo4jConfig$$EnhancerBySpringCGLIB$$bb3b006a.CGLIB$sessionFactory$3(<generated>) ~[domain-0.0.1.jar!/:0.0.1]
    at com.decisionwanted.domain.configuration.Neo4jConfig$$EnhancerBySpringCGLIB$$bb3b006a$$FastClassBySpringCGLIB$$83325def.invoke(<generated>) ~[domain-0.0.1.jar!/:0.0.1]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.1.RELEASE.jar!/:5.0.1.RELEASE]

这是我的Maven依赖树:

com.example:api:war:0.0.1
+- com.example:domain:jar:0.0.1:compile
|  +- org.neo4j:neo4j-ogm-bolt-driver:jar:3.0.1:compile
|  |  +- org.neo4j:neo4j-ogm-api:jar:3.0.1:compile
|  |  \- org.neo4j.driver:neo4j-java-driver:jar:1.4.4:compile
|  +- org.springframework.social:spring-social-security:jar:2.0.0.M4:compile
|  |  \- org.springframework.security:spring-security-web:jar:5.0.0.RC1:compile
|  +- org.springframework.security.oauth:spring-security-oauth2:jar:2.2.0.RELEASE:compile
|  |  +- org.springframework.security:spring-security-core:jar:5.0.0.RC1:compile
|  |  +- org.springframework.security:spring-security-config:jar:5.0.0.RC1:compile
|  |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
|  |     \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
|  +- org.springframework:spring-context-support:jar:5.0.1.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter-data-neo4j:jar:2.0.0.M6:compile
|  |  \- org.springframework.data:spring-data-neo4j:jar:5.0.1.RELEASE:compile
|  |     +- org.springframework.data:spring-data-commons:jar:2.0.1.RELEASE:compile
|  |     \- org.neo4j:neo4j-ogm-core:jar:3.0.1:compile
|  |        \- io.github.lukehutch:fast-classpath-scanner:jar:2.7.4:compile
|  +- org.liquigraph:liquigraph-spring-boot-starter:jar:3.0.2:compile
|  |  \- org.liquigraph:liquigraph-core:jar:3.0.2:compile
|  |     \- org.neo4j:neo4j-jdbc-driver:jar:3.1.0:compile
|  +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.0.0.M6:compile
|  |  +- com.zaxxer:HikariCP:jar:2.7.2:compile
|  |  \- org.springframework:spring-jdbc:jar:5.0.1.RELEASE:compile
|  +- org.neo4j:neo4j-jdbc-bolt:jar:3.1.0:compile
|  |  \- org.neo4j:neo4j-jdbc:jar:3.1.0:compile
|  +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:2.0.0.M6:compile
|  |  +- org.mongodb:mongodb-driver:jar:3.5.0:compile
|  |  |  +- org.mongodb:bson:jar:3.5.0:compile
|  |  |  \- org.mongodb:mongodb-driver-core:jar:3.5.0:compile
|  |  \- org.springframework.data:spring-data-mongodb:jar:2.0.1.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter-data-elasticsearch:jar:2.0.0.M6:compile
|  |  \- org.springframework.data:spring-data-elasticsearch:jar:3.0.1.RELEASE:compile
|  |     +- commons-lang:commons-lang:jar:2.6:compile
|  |     +- joda-time:joda-time:jar:2.9.9:compile
|  |     +- org.elasticsearch:elasticsearch:jar:5.5.3:compile
|  |     |  +- org.apache.lucene:lucene-core:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-analyzers-common:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-backward-codecs:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-grouping:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-highlighter:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-join:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-memory:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-misc:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-queries:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-queryparser:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-sandbox:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-spatial:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-spatial-extras:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-spatial3d:jar:6.6.0:compile
|  |     |  +- org.apache.lucene:lucene-suggest:jar:6.6.0:compile
|  |     |  +- org.elasticsearch:securesm:jar:1.1:compile
|  |     |  +- net.sf.jopt-simple:jopt-simple:jar:5.0.2:compile
|  |     |  +- com.carrotsearch:hppc:jar:0.7.1:compile
|  |     |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.9.2:compile
|  |     |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.9.2:compile
|  |     |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.9.2:compile
|  |     |  +- com.tdunning:t-digest:jar:3.0:compile
|  |     |  \- org.elasticsearch:jna:jar:4.4.0:compile
|  |     +- org.elasticsearch.client:transport:jar:5.5.3:compile
|  |     |  +- org.elasticsearch.plugin:transport-netty3-client:jar:5.5.3:compile
|  |     |  |  \- io.netty:netty:jar:3.10.6.Final:compile
|  |     |  +- org.elasticsearch.plugin:reindex-client:jar:5.5.3:compile
|  |     |  |  \- org.elasticsearch.client:rest:jar:5.5.3:compile
|  |     |  |     +- org.apache.httpcomponents:httpasyncclient:jar:4.1.3:compile
|  |     |  |     \- org.apache.httpcomponents:httpcore-nio:jar:4.4.8:compile
|  |     |  +- org.elasticsearch.plugin:lang-mustache-client:jar:5.5.3:compile
|  |     |  |  \- com.github.spullara.mustache.java:compiler:jar:0.9.3:compile
|  |     |  +- org.elasticsearch.plugin:percolator-client:jar:5.5.3:compile
|  |     |  \- org.elasticsearch.plugin:parent-join-client:jar:5.5.3:compile
|  |     \- org.elasticsearch.plugin:transport-netty4-client:jar:5.5.3:compile
|  |        +- io.netty:netty-buffer:jar:4.1.16.Final:compile
|  |        +- io.netty:netty-codec:jar:4.1.16.Final:compile
|  |        +- io.netty:netty-codec-http:jar:4.1.16.Final:compile
|  |        +- io.netty:netty-common:jar:4.1.16.Final:compile
|  |        +- io.netty:netty-handler:jar:4.1.16.Final:compile
|  |        +- io.netty:netty-resolver:jar:4.1.16.Final:compile
|  |        \- io.netty:netty-transport:jar:4.1.16.Final:compile
|  +- org.springframework.boot:spring-boot-starter-security:jar:2.0.0.M6:compile
|  +- org.springframework.boot:spring-boot-starter-validation:jar:2.0.0.M6:compile
|  +- org.springframework.boot:spring-boot-starter-social-twitter:jar:2.0.0.M6:compile
|  |  \- org.springframework.social:spring-social-twitter:jar:2.0.0.M4:compile
|  |     \- org.springframework.security:spring-security-crypto:jar:5.0.0.RC1:compile
|  +- org.springframework.kafka:spring-kafka:jar:2.0.0.RELEASE:compile
|  |  +- org.springframework:spring-messaging:jar:5.0.1.RELEASE:compile
|  |  +- org.springframework.retry:spring-retry:jar:1.2.1.RELEASE:compile
|  |  \- org.apache.kafka:kafka-clients:jar:0.11.0.0:compile
|  |     +- net.jpountz.lz4:lz4:jar:1.3.0:compile
|  |     \- org.xerial.snappy:snappy-java:jar:1.1.2.6:compile
|  +- com.google.guava:guava:jar:19.0-rc1:compile
|  +- com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:jar:20160924.1:compile
|  +- eu.bitwalker:UserAgentUtils:jar:1.20:compile
|  +- org.quartz-scheduler:quartz:jar:2.3.0:compile
|  |  +- com.mchange:c3p0:jar:0.9.5.2:compile
|  |  +- com.mchange:mchange-commons-java:jar:0.2.11:compile
|  |  \- com.zaxxer:HikariCP-java6:jar:2.3.13:compile
|  \- com.novemberain:quartz-mongodb:jar:2.0.0:compile
|     +- org.mongodb:mongo-java-driver:jar:3.5.0:runtime
|     \- org.clojure:clojure:jar:1.7.0:runtime
+- com.example:coinmarketcap:jar:0.0.1:compile
+- org.springframework.boot:spring-boot-starter-web:jar:2.0.0.M6:compile
|  +- org.springframework.boot:spring-boot-starter-json:jar:2.0.0.M6:compile
|  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.2:compile
|  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.2:compile
|  |  +- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.2:compile
|  |  \- com.fasterxml.jackson.module:jackson-module-kotlin:jar:2.9.2:compile
|  +- org.hibernate.validator:hibernate-validator:jar:6.0.4.Final:compile
|  |  +- javax.validation:validation-api:jar:2.0.0.Final:compile
|  |  \- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
|  +- org.springframework:spring-web:jar:5.0.1.RELEASE:compile
|  \- org.springframework:spring-webmvc:jar:5.0.1.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-thymeleaf:jar:2.0.0.M6:compile
|  +- org.thymeleaf:thymeleaf-spring5:jar:3.0.8.RELEASE:compile
|  |  \- org.thymeleaf:thymeleaf:jar:3.0.8.RELEASE:compile
|  |     +- org.attoparser:attoparser:jar:2.0.4.RELEASE:compile
|  |     \- org.unbescape:unbescape:jar:1.1.5.RELEASE:compile
|  \- org.thymeleaf.extras:thymeleaf-extras-java8time:jar:3.0.1.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.0.M6:compile
|  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.23:compile
|  |  \- org.apache.tomcat:tomcat-annotations-api:jar:8.5.23:compile
|  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.23:compile
|  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.23:compile
+- org.springframework.boot:spring-boot-starter-actuator:jar:2.0.0.M6:compile
|  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.0.0.M6:compile
|  |  \- org.springframework.boot:spring-boot-actuator:jar:2.0.0.M6:compile
|  \- io.micrometer:micrometer-core:jar:1.0.0-rc.3:compile
|     +- org.hdrhistogram:HdrHistogram:jar:2.1.10:compile
|     \- org.latencyutils:LatencyUtils:jar:2.0.3:compile
+- org.springframework.boot:spring-boot-starter-social-facebook:jar:2.0.0.M6:compile
|  +- org.springframework.social:spring-social-config:jar:2.0.0.M4:compile
|  +- org.springframework.social:spring-social-core:jar:2.0.0.M4:compile
|  +- org.springframework.social:spring-social-web:jar:2.0.0.M4:compile
|  \- org.springframework.social:spring-social-facebook:jar:3.0.0.M3:compile
+- org.springframework.boot:spring-boot-starter-social-linkedin:jar:2.0.0.M6:compile
|  \- org.springframework.social:spring-social-linkedin:jar:2.0.0.M3:compile
+- org.springframework.security:spring-security-jwt:jar:1.0.8.RELEASE:compile
|  \- org.bouncycastle:bcpkix-jdk15on:jar:1.56:compile
|     \- org.bouncycastle:bcprov-jdk15on:jar:1.56:compile
+- org.springframework.social:spring-social-google:jar:1.0.0.RELEASE:compile
+- org.springframework.social:spring-social-github:jar:1.0.0.M4:compile
+- com.jayway.jsonpath:json-path:jar:2.4.0:test
|  +- net.minidev:json-smart:jar:2.3:test
|  |  \- net.minidev:accessors-smart:jar:1.2:test
|  |     \- org.ow2.asm:asm:jar:5.0.4:test
|  \- org.slf4j:slf4j-api:jar:1.7.25:compile
+- com.jayway.jsonpath:json-path-assert:jar:2.4.0:test
|  +- org.hamcrest:hamcrest-core:jar:1.3:test
|  \- org.hamcrest:hamcrest-library:jar:1.3:test
+- javax.servlet:javax.servlet-api:jar:3.1.0:provided
+- javax:javaee-web-api:jar:7.0:provided
+- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
|  +- org.apache.httpcomponents:httpcore:jar:4.4.8:compile
|  \- commons-codec:commons-codec:jar:1.11:compile
+- io.springfox:springfox-swagger2:jar:2.6.0:compile
|  +- io.swagger:swagger-annotations:jar:1.5.10:compile
|  +- io.swagger:swagger-models:jar:1.5.10:compile
|  +- io.springfox:springfox-spi:jar:2.6.0:compile
|  |  \- io.springfox:springfox-core:jar:2.6.0:compile
|  +- io.springfox:springfox-schema:jar:2.6.0:compile
|  +- io.springfox:springfox-swagger-common:jar:2.6.0:compile
|  +- io.springfox:springfox-spring-web:jar:2.6.0:compile
|  +- com.fasterxml:classmate:jar:1.3.4:compile
|  +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
|  +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
|  \- org.mapstruct:mapstruct:jar:1.0.0.Final:compile
+- io.springfox:springfox-swagger-ui:jar:2.6.0:compile
+- com.github.dfabulich:sitemapgen4j:jar:1.0.6:compile
+- com.jayway.restassured:rest-assured:jar:2.9.0:test
|  +- org.codehaus.groovy:groovy:jar:2.5.0-beta-1:test
|  +- org.codehaus.groovy:groovy-xml:jar:2.5.0-beta-1:test
|  +- org.apache.httpcomponents:httpmime:jar:4.5.3:test
|  +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:test
|  +- com.jayway.restassured:json-path:jar:2.9.0:test
|  |  +- org.codehaus.groovy:groovy-json:jar:2.5.0-beta-1:test
|  |  \- com.jayway.restassured:rest-assured-common:jar:2.9.0:test
|  \- com.jayway.restassured:xml-path:jar:2.9.0:test
+- com.google.code.gson:gson:jar:2.8.2:compile
+- javax.xml.bind:jaxb-api:jar:2.2.12:compile
+- com.fasterxml.jackson.core:jackson-core:jar:2.9.2:compile
+- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
+- com.fasterxml.jackson.core:jackson-databind:jar:2.9.2:compile
+- org.springframework:spring-core:jar:5.0.1.RELEASE:compile
|  \- org.springframework:spring-jcl:jar:5.0.1.RELEASE:compile
+- org.springframework:spring-beans:jar:5.0.1.RELEASE:compile
+- org.springframework:spring-aop:jar:5.0.1.RELEASE:compile
+- org.springframework:spring-aspects:jar:5.0.1.RELEASE:compile
|  \- org.aspectj:aspectjweaver:jar:1.8.12:compile
+- org.springframework:spring-context:jar:5.0.1.RELEASE:compile
+- org.springframework:spring-expression:jar:5.0.1.RELEASE:compile
+- org.springframework:spring-tx:jar:5.0.1.RELEASE:compile
+- org.springframework.boot:spring-boot-starter:jar:2.0.0.M6:compile
|  +- javax.annotation:javax.annotation-api:jar:1.3.1:compile
|  \- org.yaml:snakeyaml:jar:1.19:compile
+- org.springframework.boot:spring-boot:jar:2.0.0.M6:compile
+- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.0.M6:compile
+- org.springframework.boot:spring-boot-starter-logging:jar:2.0.0.M6:compile
|  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
|  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
|  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.9.1:compile
|  |  \- org.apache.logging.log4j:log4j-api:jar:2.9.1:compile
|  +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
|  \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
+- org.springframework.boot:spring-boot-starter-test:jar:2.0.0.M6:test
|  +- org.springframework.boot:spring-boot-test:jar:2.0.0.M6:test
|  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.0.M6:test
|  +- org.assertj:assertj-core:jar:3.8.0:test
|  +- org.mockito:mockito-core:jar:2.11.0:test
|  |  +- net.bytebuddy:byte-buddy:jar:1.7.8:test
|  |  +- net.bytebuddy:byte-buddy-agent:jar:1.7.8:test
|  |  \- org.objenesis:objenesis:jar:2.6:test
|  +- org.skyscreamer:jsonassert:jar:1.5.0:test
|  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
|  +- org.springframework:spring-test:jar:5.0.1.RELEASE:test
|  \- org.xmlunit:xmlunit-core:jar:2.5.0:test
+- javax.enterprise:cdi-api:jar:2.0-EDR1:compile
|  +- javax.el:javax.el-api:jar:3.0.0:compile
|  +- javax.interceptor:javax.interceptor-api:jar:1.2:compile
|  \- javax.inject:javax.inject:jar:1:compile
+- javax.transaction:jta:jar:1.1:compile
+- org.apache.commons:commons-lang3:jar:3.4:compile
+- commons-validator:commons-validator:jar:1.5.0:compile
|  +- commons-beanutils:commons-beanutils:jar:1.9.3:compile
|  +- commons-digester:commons-digester:jar:2.1:compile
|  +- commons-logging:commons-logging:jar:1.2:compile
|  \- commons-collections:commons-collections:jar:3.2.2:compile
+- commons-io:commons-io:jar:2.4:compile
+- org.apache.commons:commons-compress:jar:1.14:compile
\- junit:junit:jar:4.12:test

可能有什么问题以及如何解决?

1 个答案:

答案 0 :(得分:1)

版本3.1.0的JDBC驱动程序使用版本1.3.0的Bolt Java驱动程序,而OGM使用版本1.4.4的Bolt Java驱动程序。

因为后者是依赖关系树中根的最近邻居,这意味着JDBC驱动程序最终会与1.4.4版本的Bolt驱动程序进行交互,而且它似乎不兼容。

版本3.1.0的JDBC驱动程序使用版本1.3.0的Bolt Java驱动程序,而OGM使用版本1.4.4的Bolt Java驱动程序。

因为后者是依赖关系树中根的最近邻居,这意味着JDBC驱动程序最终会与1.4.4版本的Bolt驱动程序进行交互,而且它似乎不兼容。

只需从neo4j-java-driver驱动程序中排除neo4j-jdbc-bolt

<dependency>
  <groupId>org.neo4j</groupId>
  <artifactId>neo4j-jdbc-bolt</artifactId>
  <version>3.1.0</version>
  <exclusions>
    <exclusion>
      <groupId>org.neo4j.driver</groupId>
      <artifactId>neo4j-java-driver</artifactId>
    </exclusion>
  </exclusions>
</dependency>