我最近升级到Spring-Data-Neo4j 4.1.0-BUILD-SNAPSHOT(使用neo4j-ogm 2.0.0-M01)并注意到检索@QueryResult的查询不再有效。我收到以下错误:
java.lang.NoSuchMethodError: org.neo4j.ogm.response.model.DefaultRestModel.<init>(Ljava/util/Map;)V
at org.neo4j.ogm.drivers.http.response.RestModelResponse.next(RestModelResponse.java:39)
at org.neo4j.ogm.drivers.http.response.RestModelResponse.next(RestModelResponse.java:28)
at org.neo4j.ogm.context.RestModelMapper.map(RestModelMapper.java:53)
at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.query(ExecuteQueriesDelegate.java:97)
at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.query(ExecuteQueriesDelegate.java:76)
at org.neo4j.ogm.session.Neo4jSession.query(Neo4jSession.java:313)
at org.springframework.data.neo4j.repository.query.QueryResultGraphRepositoryQuery$1.apply(QueryResultGraphRepositoryQuery.java:69)
at org.springframework.data.neo4j.repository.query.QueryResultGraphRepositoryQuery$1.apply(QueryResultGraphRepositoryQuery.java:64)
at org.neo4j.ogm.session.delegates.TransactionsDelegate.doInTransaction(TransactionsDelegate.java:46)
at org.neo4j.ogm.session.Neo4jSession.doInTransaction(Neo4jSession.java:386)
at org.springframework.data.neo4j.repository.query.QueryResultGraphRepositoryQuery.mapToConcreteType(QueryResultGraphRepositoryQuery.java:64)
at org.springframework.data.neo4j.repository.query.QueryResultGraphRepositoryQuery.execute(QueryResultGraphRepositoryQuery.java:52)
at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:52)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy49.getParticipatingMolecules2(Unknown Source)
at uk.ac.ebi.reactome.service.DatabaseObjectServiceImpl.getParticipatingMolecules2(DatabaseObjectServiceImpl.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
at uk.ac.ebi.reactome.aop.LoggingAspect.monitorExecutionTimes(LoggingAspect.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy51.getParticipatingMolecules2(Unknown Source)
at uk.ac.ebi.reactome.service.DatabaseObjectServiceTest.testGetParticipatingMolecules2(DatabaseObjectServiceTest.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
@QueryResult对象:
@QueryResult
public class Participant {
private Long ewasDbId;
private String ewasName;
private Collection<Long> refEntityDbIds;
private Collection<String> refEntityNames;
}
查询:
@Query("MATCH (n:Pathway{dbId:{0}})-[:hasEvent|input|output*]->(m)-[:hasMember|hasComponent|hasCandidate|repeatedUnit|referenceEntity*]->(x:ReferenceEntity) RETURN m.dbId AS ewasDbId, m.displayName AS ewasName, COLLECT(DISTINCT x.dbId) AS refEntityDbIds, COLLECT(DISTINCT x.displayName) AS refEntityNames")
Collection<Participant> getParticipatingMolecules2(Long dbId);
依赖关系:
<!--Spring data neo4j-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>4.1.0.BUILD-SNAPSHOT</version>
</dependency>
<!--Neo4j object graph mapping -->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-api</artifactId>
<version>2.0.0-M01</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-core</artifactId>
<version>2.0.0-M01</version>
</dependency>
...
依赖树
[INFO] +- org.reactome.base:reactome-base:jar:1.2.1:compile
[INFO] | \- mysql:mysql-connector-java:jar:5.1.28:compile
[INFO] +- org.springframework.data:spring-data-neo4j:jar:4.1.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.12.0.BUILD-SNAPSHOT:compile
[INFO] | | \- org.springframework:spring-beans:jar:4.1.9.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.1.9.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.1.9.RELEASE:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | \- org.springframework:spring-expression:jar:4.1.9.RELEASE:compile
[INFO] | +- org.springframework:spring-tx:jar:4.1.9.RELEASE:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.13:compile
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.13:runtime
[INFO] +- org.springframework:spring-test:jar:4.2.4.RELEASE:test
[INFO] | \- org.springframework:spring-core:jar:4.2.4.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.neo4j:neo4j-ogm-api:jar:2.0.0-M01:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.5.1:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.5.1:compile
[INFO] | +- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] | +- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] | \- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- org.neo4j:neo4j-ogm-core:jar:2.0.0-M01:compile
[INFO] | +- org.neo4j:neo4j-ogm-compiler:jar:2.0.0-SNAPSHOT:compile
[INFO] | +- org.neo4j:neo4j-ogm-drivers:jar:2.0.0-SNAPSHOT:compile
[INFO] | | +- org.neo4j:neo4j:jar:2.3.2:compile
[INFO] | | | +- org.neo4j:neo4j-kernel:jar:2.3.2:compile
[INFO] | | | | +- org.neo4j:neo4j-primitive-collections:jar:2.3.2:compile
[INFO] | | | | | +- org.neo4j:neo4j-unsafe:jar:2.3.2:compile
[INFO] | | | | | \- org.neo4j:neo4j-function:jar:2.3.2:compile
[INFO] | | | | +- org.neo4j:neo4j-io:jar:2.3.2:compile
[INFO] | | | | | \- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] | | | | +- org.neo4j:neo4j-csv:jar:2.3.2:compile
[INFO] | | | | \- org.neo4j:neo4j-logging:jar:2.3.2:compile
[INFO] | | | +- org.neo4j:neo4j-lucene-index:jar:2.3.2:compile
[INFO] | | | | \- org.apache.lucene:lucene-core:jar:3.6.2:compile
[INFO] | | | +- org.neo4j:neo4j-graph-algo:jar:2.3.2:compile
[INFO] | | | +- org.neo4j:neo4j-udc:jar:2.3.2:compile
[INFO] | | | +- org.neo4j:neo4j-graph-matching:jar:2.3.2:compile
[INFO] | | | +- org.neo4j:neo4j-cypher:jar:2.3.2:compile
[INFO] | | | | +- org.scala-lang:scala-library:jar:2.11.7:compile
[INFO] | | | | +- org.scala-lang:scala-reflect:jar:2.11.7:compile
[INFO] | | | | +- org.scala-lang.modules:scala-parser-combinators_2.11:jar:1.0.4:compile
[INFO] | | | | +- org.neo4j:neo4j-codegen:jar:2.3.2:compile
[INFO] | | | | | \- org.ow2.asm:asm:jar:5.0.2:compile
[INFO] | | | | +- org.neo4j:neo4j-cypher-compiler-1.9_2.11:jar:2.0.5:compile
[INFO] | | | | +- org.neo4j:neo4j-cypher-compiler-2.2_2.11:jar:2.2.6:compile
[INFO] | | | | +- org.neo4j:neo4j-cypher-compiler-2.3:jar:2.3.2:compile
[INFO] | | | | | \- org.neo4j:neo4j-cypher-frontend-2.3:jar:2.3.2:compile
[INFO] | | | | +- org.parboiled:parboiled-scala_2.11:jar:1.1.7:compile
[INFO] | | | | | \- org.parboiled:parboiled-core:jar:1.1.7:compile
[INFO] | | | | +- net.sf.opencsv:opencsv:jar:2.3:compile
[INFO] | | | | \- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.4.2:compile
[INFO] | | | +- org.neo4j:neo4j-jmx:jar:2.3.2:compile
[INFO] | | | \- org.neo4j:neo4j-consistency-check:jar:2.3.2:compile
[INFO] | | | \- org.neo4j:neo4j-consistency-check-legacy:jar:2.3.2:compile
[INFO] | | +- org.neo4j.driver:neo4j-java-driver:jar:1.0.0-M01:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.3.6:compile
[INFO] | | | \- org.apache.httpcomponents:httpcore:jar:4.3.3:compile
[INFO] | | \- commons-io:commons-io:jar:2.4:compile
[INFO] | \- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.8.8:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] \- com.martiansoftware:jsap:jar:2.1:compile
我做错了什么,或者这是一个将来会修复的问题?
感谢您的帮助
答案 0 :(得分:4)
不确定这是怎么发生的,但看起来它想要neo4j-ogm 2.0.0-SNAPSHOT
您可以执行mvn clean -U ...
并查看是否可以解决问题,还是使用neo4j-ogm快照?你需要包括
<repository>
<id>neo4j-snapshots</id>
<url>http://m2.neo4j.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<强>更新强>
您的依赖关系树包含混合版本
+- org.neo4j:neo4j-ogm-core:jar:2.0.0-M01:compile
[INFO] | +- org.neo4j:neo4j-ogm-compiler:jar:2.0.0-SNAPSHOT:compile
[INFO] | +- org.neo4j:neo4j-ogm-drivers:jar:2.0.0-SNAPSHOT:compile
它应该具有2.0.0-M01或2.0.0-SNAPSHOT,但不能同时具有两者,因为它们与QueryResult不兼容。 也许从本地maven存储库(org / neo4j / neo4j-ogm)删除2.0.0-M01和2.0.0-SNAPSHOT并强制使用mvn -U进行更新?