Spring boot 2.0 neo4j ogm 3.0 compatible jetty ver

2019-05-14 11:57发布

I'm trying to upgrade spring boot from 1.5 to 2.0 and facing issue with jetty version. I'm new to neo4j ogm and spring boot.

When I try to run a test case it fails with below error.

    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)

and tried simply adding jetty.version referred here in this issue, Spring boot integration test fails with Neo4j.

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

while adding the above on pom.xml, test case alone passing fine which is working as expected. But unable to build the app and ends up with jetty error below.

[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] 

And the code sample can be seen here, https://github.com/nkumarclm/springboot2.0_neo4jogm3.0/

Just would like to know if there are any version compatibility problem on using or any suggestion to run tests with .cql file with provided spring & neo4j ogm versions?

Thanks very much in advance.

2条回答
何必那么认真
2楼-- · 2019-05-14 12:46

I tried reaching Neo4j team and here is the response I received.

The root problem is the dependency mismatch between SpringBoot and Neo4j on jetty. The problem occurs because you are using the MultiDriverTestClass from the neo4j-ogm-test module. It will spawn a Neo4j instance that will take request over the given transport mode defined via the protocol you defined in your ogm.properties file. If you would alter your test base to an embedded instance, you could work around the problem: Remove the MultiDriverTestClass inheritance and create a Configuration on your own like Configuration configuration = new Configuration.Builder(new ClasspathConfigurationSource("ogm.properties")).build();. The content of the ogm.properties should be empty to force OGM to create a new temporary embedded instance.

查看更多
虎瘦雄心在
3楼-- · 2019-05-14 12:50

The Jetty Internal class org.eclipse.jetty.server.SessionManager, existed for all versions of Eclipse Jetty 7.0.x thru 9.3.x.

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

The class org.eclipse.jetty.server.SessionManager was removed in 9.4.x as part of that major version refactor of Session handling.

As for ...

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

The jetty-bom artifact, as a concept, has existed since Jetty 9.3.19.v20170502, in various bad and unsupported states until it was finally improved at Jetty 9.4.7.v20180619 for the users of spring-boot.

Lets look at the raw dependency tree for github.com/nkumarclm/springboot2.0_neo4jogm3.0

(This is the raw tree, without locally specified versions)

$ 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] ------------------------------------------------------------------------

From here we learn that the parent org.springframework.boot:spring-boot-starter-parent:2.0.0.RELEASE has a requirement for org.eclipse.jetty:jetty-server:jar:9.4.8.v20171121.

Note: Jetty versioning (since 1995) is <servlet_support>.<major_version>.<minor_version>

So you have:

  • spring-boot requiring a Jetty major version of 9.4.x
  • neo4jogm requiring Jetty major version 9.2.x

That's just incompatible.

The project github.com/nkumarclm/springboot2.0_neo4jogm3.0 cannot function the way its defined / configured. It would seem that either neo4jogm should be upgraded to support Jetty 9.4.x, or spring-boot should be downgraded to support Jetty 9.2.x.

In short, you have a bigger issue then merely picking the right version of Jetty.

查看更多
登录 后发表回答