代码之家  ›  专栏  ›  技术社区  ›  Naveen qamnott

Spring Boot 2.0 Neo4J OGM 3.0兼容Jetty版本

  •  3
  • Naveen qamnott  · 技术社区  · 6 年前

    我正在尝试将SpringBoot从1.5升级到2.0,并面临Jetty版本的问题。我对Neo4J OGM和弹簧靴很陌生。

    当我试图运行一个测试用例时,它失败了,错误如下。

        java.lang.NoClassDefFoundError: org/eclipse/jetty/server/SessionManager
    
            at org.neo4j.server.CommunityNeoServer.createWebServer(CommunityNeoServer.java:90)
            at org.neo4j.server.AbstractNeoServer.init(AbstractNeoServer.java:188)
            at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:204)
            at org.neo4j.harness.internal.InProcessServerControls.start(InProcessServerControls.java:71)
            at org.neo4j.harness.internal.AbstractInProcessServerBuilder.newServer(AbstractInProcessServerBuilder.java:151)
            at org.neo4j.ogm.testutil.TestServer.startServer(TestServer.java:75)
            at org.neo4j.ogm.testutil.TestServer.(TestServer.java:63)
            at org.neo4j.ogm.testutil.TestServer.(TestServer.java:53)
    

    并尝试简单地添加本期中提到的jetty.version, Spring boot integration test fails with Neo4j 是的。

    <jetty.version>9.2.9.v20150224</jetty.version>
    

    在pom.xml上添加上述内容时,只需测试用例就可以正常工作。但无法构建应用程序,最终出现以下Jetty错误。

    [ERROR]   The project com.example:demo:0.0.1-SNAPSHOT (C:\code\Springboot2.0_Neo4jOGM_Sample\pom.xml) has 1 error
    [ERROR]     Non-resolvable import POM: Failure to find org.eclipse.jetty:jetty-bom:pom:9.2.9.v20150224 in https://repo.spring.io/milestone was cached in the local repository, resolution will not be reattempted until the update interval of spring-milestone has elapsed or updates are forced @ org.springframework.boot:spring-boot-dependencies:2.0.0.RELEASE, C:\Users\nkumar\.m2\repository\org\springframework\boot\spring-boot-dependencies\2.0.0.RELEASE\spring-boot-dependencies-2.0.0.RELEASE.pom, line 1652, column 25 -> [Help 2]
    [ERROR] 
    

    代码示例可以在这里看到, https://github.com/nkumarclm/springboot2.0_neo4jogm3.0/

    只想知道在使用提供的Spring&Neo4J OGM版本的.cql文件运行测试时是否存在版本兼容性问题或任何建议?

    非常感谢提前。

    2 回复  |  直到 6 年前
        1
  •  1
  •   Joakim Erdfelt    6 年前

    码头内部舱位 org.eclipse.jetty.server.SessionManager ,所有版本的Eclipse JETTY 7。x,9.3,x。

    http://search.maven.org/#search%7Cga%7C1%7Cfc%3A%22org.eclipse.jetty.server.SessionManager%22

    班级 org.eclipse.jetty.server.sessionmanager网站 在9.4.x中作为会话处理的主要版本重构的一部分被删除。

    至于。。。

    Non-resolvable import POM: Failure to find org.eclipse.jetty:jetty-bom:pom:9.2.9.v20150224 ...
    

    这个 jetty-bom 工件,作为一个概念,从jetty 9.3.19.v20170502开始就一直存在,处于各种不好和不受支持的状态,直到最终在jetty 9.4.7.v20180619为spring boot用户改进。

    让我们看看原始依赖树 github.com/nkumarclm/springboot2.0_neo4jogm3.0

    (这是原始树,没有本地指定的版本)

    $ mvn dependency:tree
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building demo 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-dependency-plugin:3.0.1:tree (default-cli) @ demo ---
    [INFO] com.example:demo:jar:0.0.1-SNAPSHOT
    [INFO] +- org.springframework.boot:spring-boot-starter-data-neo4j:jar:2.0.0.RELEASE:compile
    [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.0.RELEASE:compile
    [INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.10.0:compile
    [INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
    [INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
    [INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
    [INFO] |  |  \- org.yaml:snakeyaml:jar:1.19:runtime
    [INFO] |  \- org.springframework.data:spring-data-neo4j:jar:5.0.5.RELEASE:compile
    [INFO] |     +- org.springframework:spring-tx:jar:5.0.4.RELEASE:compile
    [INFO] |     +- org.springframework:spring-context:jar:5.0.4.RELEASE:compile
    [INFO] |     |  +- org.springframework:spring-aop:jar:5.0.4.RELEASE:compile
    [INFO] |     |  \- org.springframework:spring-expression:jar:5.0.4.RELEASE:compile
    [INFO] |     +- org.springframework:spring-beans:jar:5.0.4.RELEASE:compile
    [INFO] |     +- org.springframework.data:spring-data-commons:jar:2.0.5.RELEASE:compile
    [INFO] |     \- org.slf4j:slf4j-api:jar:1.7.25:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.0.0.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.0.0.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.0.RELEASE:test
    [INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
    [INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
    [INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
    [INFO] |  |        \- org.ow2.asm:asm:jar:5.0.4:test
    [INFO] |  +- junit:junit:jar:4.12:test
    [INFO] |  +- org.assertj:assertj-core:jar:3.9.1:test
    [INFO] |  +- org.mockito:mockito-core:jar:2.15.0:test
    [INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.7.10:test
    [INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.7.10:test
    [INFO] |  |  \- org.objenesis:objenesis:jar:2.6:test
    [INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
    [INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
    [INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
    [INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
    [INFO] |  +- org.springframework:spring-core:jar:5.0.4.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-jcl:jar:5.0.4.RELEASE:compile
    [INFO] |  +- org.springframework:spring-test:jar:5.0.4.RELEASE:test
    [INFO] |  \- org.xmlunit:xmlunit-core:jar:2.5.1:test
    [INFO] +- org.projectlombok:lombok:jar:1.16.20:provided
    [INFO] +- org.codehaus.janino:janino:jar:3.0.8:compile
    [INFO] |  \- org.codehaus.janino:commons-compiler:jar:3.0.8:compile
    [INFO] +- org.neo4j.driver:neo4j-java-driver:jar:1.6.1:compile
    [INFO] \- org.neo4j:neo4j-ogm-test:jar:3.1.0:test
    [INFO]    +- org.neo4j:neo4j-ogm-http-driver:jar:3.1.0:test
    [INFO]    |  +- org.neo4j:neo4j-ogm-api:jar:3.1.0:compile
    [INFO]    |  |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.4:compile
    [INFO]    |  |     +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
    [INFO]    |  |     \- com.fasterxml.jackson.core:jackson-core:jar:2.9.4:compile
    [INFO]    |  +- org.apache.httpcomponents:httpclient:jar:4.5.5:test
    [INFO]    |  \- commons-io:commons-io:jar:2.4:compile
    [INFO]    +- org.neo4j:neo4j-ogm-core:jar:3.1.0:compile
    [INFO]    |  +- org.apache.commons:commons-lang3:jar:3.7:compile
    [INFO]    |  \- io.github.lukehutch:fast-classpath-scanner:jar:2.7.4:compile
    [INFO]    +- org.neo4j:neo4j-ogm-embedded-driver:jar:3.1.0:test
    [INFO]    +- org.neo4j:neo4j-ogm-bolt-driver:jar:3.1.0:compile
    [INFO]    +- ch.qos.logback:logback-classic:jar:1.2.3:compile
    [INFO]    |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
    [INFO]    +- com.google.guava:guava:jar:21.0:test
    [INFO]    +- org.neo4j.test:neo4j-harness:jar:3.2.9:test
    [INFO]    |  +- org.neo4j:neo4j:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-lucene-index:jar:3.2.9:test
    [INFO]    |  |  |  +- org.apache.lucene:lucene-analyzers-common:jar:5.5.0:test
    [INFO]    |  |  |  +- org.apache.lucene:lucene-core:jar:5.5.0:test
    [INFO]    |  |  |  +- org.apache.lucene:lucene-queryparser:jar:5.5.0:test
    [INFO]    |  |  |  \- org.apache.lucene:lucene-codecs:jar:5.5.0:test
    [INFO]    |  |  +- org.neo4j:neo4j-graph-algo:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-udc:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-cypher:jar:3.2.9:test
    [INFO]    |  |  |  +- org.scala-lang:scala-library:jar:2.11.12:test
    [INFO]    |  |  |  +- org.scala-lang:scala-reflect:jar:2.11.12:test
    [INFO]    |  |  |  +- org.neo4j:neo4j-graph-matching:jar:3.1.3:test
    [INFO]    |  |  |  +- org.neo4j:neo4j-codegen:jar:3.2.9:test
    [INFO]    |  |  |  +- org.neo4j:neo4j-cypher-compiler-2.3:jar:2.3.11:test
    [INFO]    |  |  |  |  +- org.neo4j:neo4j-cypher-frontend-2.3:jar:2.3.11:test
    [INFO]    |  |  |  |  \- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.4.2:test
    [INFO]    |  |  |  +- org.neo4j:neo4j-cypher-compiler-3.1:jar:3.1.6:test
    [INFO]    |  |  |  |  +- org.neo4j:neo4j-cypher-frontend-3.1:jar:3.1.6:test
    [INFO]    |  |  |  |  \- com.github.ben-manes.caffeine:caffeine:jar:2.6.2:test
    [INFO]    |  |  |  +- org.neo4j:neo4j-cypher-compiler-3.2:jar:3.2.9:test
    [INFO]    |  |  |  |  +- org.neo4j:neo4j-cypher-frontend-3.2:jar:3.2.9:test
    [INFO]    |  |  |  |  \- org.neo4j:neo4j-cypher-ir-3.2:jar:3.2.9:test
    [INFO]    |  |  |  +- org.parboiled:parboiled-scala_2.11:jar:1.1.7:test
    [INFO]    |  |  |  |  \- org.parboiled:parboiled-core:jar:1.1.7:test
    [INFO]    |  |  |  \- net.sf.opencsv:opencsv:jar:2.3:test
    [INFO]    |  |  +- org.neo4j:neo4j-jmx:jar:3.2.9:test
    [INFO]    |  |  \- org.neo4j:neo4j-consistency-check:jar:3.2.9:test
    [INFO]    |  +- org.neo4j.app:neo4j-server:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j:pom:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-security:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-dbms:jar:3.2.9:test
    [INFO]    |  |  |  +- org.neo4j:neo4j-import-tool:jar:3.2.9:test
    [INFO]    |  |  |  \- org.apache.commons:commons-compress:jar:1.12:test
    [INFO]    |  |  +- org.neo4j:neo4j-command-line:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:server-api:jar:3.2.9:test
    [INFO]    |  |  |  \- org.neo4j.3rdparty.javax.ws.rs:jsr311-api:jar:1.1.2.r612:test
    [INFO]    |  |  +- org.neo4j:neo4j-bolt:jar:3.2.9:test
    [INFO]    |  |  |  \- io.netty:netty-all:jar:4.1.22.Final:test
    [INFO]    |  |  +- org.neo4j.client:neo4j-browser:jar:3.1.4:test
    [INFO]    |  |  +- org.neo4j:neo4j-shell:jar:3.2.9:test
    [INFO]    |  |  |  \- jline:jline:jar:2.12:test
    [INFO]    |  |  +- org.eclipse.jetty:jetty-server:jar:9.4.8.v20171121:test
    [INFO]    |  |  |  +- javax.servlet:javax.servlet-api:jar:3.1.0:test
    [INFO]    |  |  |  +- org.eclipse.jetty:jetty-http:jar:9.4.8.v20171121:test
    [INFO]    |  |  |  |  \- org.eclipse.jetty:jetty-util:jar:9.4.8.v20171121:test
    [INFO]    |  |  |  \- org.eclipse.jetty:jetty-io:jar:9.4.8.v20171121:test
    [INFO]    |  |  +- org.eclipse.jetty:jetty-webapp:jar:9.4.8.v20171121:test
    [INFO]    |  |  |  +- org.eclipse.jetty:jetty-xml:jar:9.4.8.v20171121:test
    [INFO]    |  |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.4.8.v20171121:test
    [INFO]    |  |  |     \- org.eclipse.jetty:jetty-security:jar:9.4.8.v20171121:test
    [INFO]    |  |  +- com.sun.jersey:jersey-server:jar:1.19:test
    [INFO]    |  |  +- com.sun.jersey:jersey-servlet:jar:1.19:test
    [INFO]    |  |  +- commons-configuration:commons-configuration:jar:1.10:test
    [INFO]    |  |  |  +- commons-lang:commons-lang:jar:2.6:test
    [INFO]    |  |  |  \- commons-logging:commons-logging:jar:1.1.1:test
    [INFO]    |  |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.13:test
    [INFO]    |  |  |  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:test
    [INFO]    |  |  |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:test
    [INFO]    |  |  +- org.mozilla:rhino:jar:1.7R4:test
    [INFO]    |  |  +- org.bouncycastle:bcprov-jdk15on:jar:1.53:test
    [INFO]    |  |  +- org.bouncycastle:bcpkix-jdk15on:jar:1.53:test
    [INFO]    |  |  \- com.sun.jersey.contribs:jersey-multipart:jar:1.19:test
    [INFO]    |  |     \- org.jvnet.mimepull:mimepull:jar:1.9.3:test
    [INFO]    |  +- org.neo4j:neo4j-common:test-jar:tests:3.2.9:test
    [INFO]    |  +- org.neo4j:neo4j-kernel:test-jar:tests:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-graphdb-api:jar:3.2.9:test
    [INFO]    |  |  |  \- org.neo4j:neo4j-resource:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-common:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-collections:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-primitive-collections:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-io:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-csv:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-logging:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-lucene-upgrade:jar:3.2.9:test
    [INFO]    |  |  |  \- org.apache.lucene:lucene-backward-codecs:jar:5.5.0:test
    [INFO]    |  |  +- org.neo4j:neo4j-configuration:jar:3.2.9:test
    [INFO]    |  |  +- org.neo4j:neo4j-index:jar:3.2.9:test
    [INFO]    |  |  \- org.neo4j:neo4j-ssl:jar:3.2.9:test
    [INFO]    |  +- org.neo4j:neo4j-io:test-jar:tests:3.2.9:test
    [INFO]    |  |  \- org.neo4j:neo4j-unsafe:jar:3.2.9:test
    [INFO]    |  +- com.sun.jersey:jersey-client:jar:1.19:test
    [INFO]    |  |  \- com.sun.jersey:jersey-core:jar:1.19:test
    [INFO]    |  +- org.neo4j.app:neo4j-server:test-jar:tests:3.2.9:test
    [INFO]    |  +- commons-codec:commons-codec:jar:1.11:compile
    [INFO]    |  +- org.apache.httpcomponents:httpcore:jar:4.4.9:test
    [INFO]    |  \- org.neo4j:neo4j-kernel:jar:3.2.9:test
    [INFO]    \- org.slf4j:jcl-over-slf4j:jar:1.7.25:test
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.939 s
    [INFO] Finished at: 2018-07-03T12:58:10Z
    [INFO] Final Memory: 26M/88M
    [INFO] ------------------------------------------------------------------------
    

    从这里我们了解到 org.springframework.boot:spring-boot-starter-parent:2.0.0.RELEASE 要求 org.eclipse.jetty:jetty-server:jar:9.4.8.v20171121 是的。

    注:Jetty版本控制(自1995年起)是 <servlet_support>.<major_version>.<minor_version>

    所以你有:

    • 需要Jetty主版本9.4.x的Spring Boot
    • Neo4Jogm需要码头主版本9.2.x

    这是不相容的。

    项目 github.com/nkumarcm/springboot2.0_neo4jogm3.0网站 无法按其定义/配置的方式运行。似乎Neo4Jogm应该升级以支持Jetty 9.4.x,或者Spring Boot应该降级以支持Jetty 9.2.x。

    简言之,你有一个更大的问题,然后仅仅选择正确版本的码头。

        2
  •  0
  •   Naveen qamnott    6 年前

    我试着联系了Neo4J小组,这是我收到的回复。

    根本问题是SpringBoot和Neo4J在Jetty上的依赖不匹配。出现此问题是因为您正在使用 MultiDriverTestClass 来自NEO4J OGM测试模块。 它将生成一个neo4j实例,该实例将接管通过在 ogm.properties 文件。 如果要将测试基更改为嵌入式实例,可以解决以下问题: 移除 多驱动器类 继承并创建 Configuration 你自己喜欢 Configuration configuration = new Configuration.Builder(new ClasspathConfigurationSource("ogm.properties")).build(); 是的。的内容 OGM属性 应为空以强制ogm创建新的临时嵌入实例。