I cannot build a simple metric from a java application using the Stackdriver Monitoring client when I have a dependency to the Google Dataflow client.
I get the exception:
Exception in thread "main" java.lang.NoSuchMethodError: io.grpc.okhttp.OkHttpChannelProvider.isAndroid()Z
at io.grpc.okhttp.OkHttpChannelProvider.priority(OkHttpChannelProvider.java:51)
at io.grpc.ManagedChannelProvider$1.getPriority(ManagedChannelProvider.java:49)
at io.grpc.ManagedChannelProvider$1.getPriority(ManagedChannelProvider.java:41)
at io.grpc.ServiceProviders$1.compare(ServiceProviders.java:78)
at java.util.Collections$ReverseComparator2.compare(Collections.java:5178)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.util.TimSort.sort(TimSort.java:220)
at java.util.Arrays.sort(Arrays.java:1512)
at java.util.ArrayList.sort(ArrayList.java:1462)
at java.util.Collections.sort(Collections.java:175)
at io.grpc.ServiceProviders.loadAll(ServiceProviders.java:75)
at io.grpc.ServiceProviders.load(ServiceProviders.java:42)
at io.grpc.ManagedChannelProvider.<clinit>(ManagedChannelProvider.java:37)
at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:36)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:185)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:157)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:149)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:151)
at com.google.cloud.monitoring.v3.stub.GrpcMetricServiceStub.create(GrpcMetricServiceStub.java:173)
at com.google.cloud.monitoring.v3.stub.MetricServiceStubSettings.createStub(MetricServiceStubSettings.java:184)
at com.google.cloud.monitoring.v3.MetricServiceClient.<init>(MetricServiceClient.java:158)
at com.google.cloud.monitoring.v3.MetricServiceClient.create(MetricServiceClient.java:139)
at com.google.cloud.monitoring.v3.MetricServiceClient.create(MetricServiceClient.java:130)
at SimpleMetric.main(SimpleMetric.java:7)
on the create method:
import com.google.cloud.monitoring.v3.MetricServiceClient;
import java.io.IOException;
public class SimpleMetric {
public static void main(String... args) throws IOException {
MetricServiceClient metricServiceClient = MetricServiceClient.create();
}
}
only when I add:
compile 'com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:2.5.0'
as in my gradle file as a dependency.
plugins {
id 'java'
}
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile 'com.google.cloud:google-cloud-monitoring:1.48.0'
// exception with the dependency below
compile 'com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:2.5.0'
}
I reported the issue to Google. In the meantime, is there a workaround?
isAndroid was defined in io.grpc.ManagedChannelProvider taken out of grpc-core in version 1.11. The error means somehow you are using grpc-okhttp from before 1.11 and grpc-core from 1.11 or later.
google-cloud-monitoring 1.48.0 depends indirectly on grpc-core 1.13:
com.google.cloud:google-cloud-monitoring:jar:1.48.0:compile
+- com.google.cloud:google-cloud-core:jar:1.48.0:compile
+- com.google.cloud:google-cloud-core-grpc:jar:1.48.0:compile
| +- io.grpc:grpc-protobuf:jar:1.13.1:compile
| | \- io.grpc:grpc-protobuf-lite:jar:1.13.1:compile
| +- io.grpc:grpc-context:jar:1.13.1:compile
+- com.google.api.grpc:proto-google-cloud-monitoring-v3:jar:1.30.0:compile
+- io.grpc:grpc-netty-shaded:jar:1.13.1:compile
| \- io.grpc:grpc-core:jar:1.13.1:compile (version selected from constraint [1.13.1,1.13.1])
| +- com.google.errorprone:error_prone_annotations:jar:2.1.2:compile
| +- io.opencensus:opencensus-api:jar:0.12.3:compile
| \- io.opencensus:opencensus-contrib-grpc-metrics:jar:0.12.3:compile
+- io.grpc:grpc-stub:jar:1.13.1:compile
\- io.grpc:grpc-auth:jar:1.13.1:compile
google-cloud-dataflow-java-sdk-all 2.5.0 depends indirectly on grpc-core 1.2 and grpc-okhttp 1.2:
com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:jar:2.5.0:compile
+- org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.5.0:compile
| +- io.grpc:grpc-core:jar:1.2.0:compile
| | +- com.google.errorprone:error_prone_annotations:jar:2.0.11:compile
| | +- io.grpc:grpc-context:jar:1.2.0:compile
| | \- com.google.instrumentation:instrumentation-api:jar:0.3.0:compile
| +- com.google.api:gax-grpc:jar:0.20.0:compile
| | +- io.grpc:grpc-protobuf:jar:1.2.0:compile
| | +- com.google.api:api-common:jar:1.1.0:compile
| | +- com.google.auto.value:auto-value:jar:1.2:compile
| | +- com.google.api:gax:jar:1.3.1:compile
| | \- org.threeten:threetenbp:jar:1.3.3:compile
| +- io.grpc:grpc-auth:jar:1.2.0:compile
| +- io.grpc:grpc-netty:jar:1.2.0:compile
| +- io.grpc:grpc-stub:jar:1.2.0:compile
| +- io.grpc:grpc-all:jar:1.2.0:compile
| | +- io.grpc:grpc-okhttp:jar:1.2.0:compile
| | | +- com.squareup.okhttp:okhttp:jar:2.5.0:compile
| | | \- com.squareup.okio:okio:jar:1.6.0:compile
So basically dataflow is out of date and causing a conflict. The dataflow SDK isn't supported anymore, as it is now Apache Beam. Consider migrating to solve the issue.
I am attempting to use powermock to mock javax.print.PrintServiceLookup however the below tests fails to start up. I am able to successfully mock other static classes with this setup, just not with PrintServiceLookup
#RunWith( PowerMockRunner.class )
#SpringBootTest
#PowerMockRunnerDelegate(SpringRunner.class)
#TestPropertySource( "classpath:application-test.properties" )
#PrepareForTest( {PrintServiceLookup.class} )
public class PrinterUtilTest {
#Autowired
private PropertyUtil propertyUtil;
#Autowired
private PrinterUtil printerUtil;
//... other tests
}
Fails with Illegal state exception.
"C:\Program Files\Java\jdk1.8.0_111\bin\java" -ea -Didea.launcher.port=7536 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3\plugins\junit\lib\junit-rt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\rt.jar;C:\DEV\freedom-print\target\test-classes;C:\DEV\freedom-print\target\classes;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-web\1.5.2.RELEASE\spring-boot-starter-web-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter\1.5.2.RELEASE\spring-boot-starter-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.5.2.RELEASE\spring-boot-starter-logging-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;C:\Users\Bryce.Chernecki\.m2\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.24\jcl-over-slf4j-1.7.24.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\slf4j\jul-to-slf4j\1.7.24\jul-to-slf4j-1.7.24.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.24\log4j-over-slf4j-1.7.24.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\hibernate\hibernate-validator\5.3.4.Final\hibernate-validator-5.3.4.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\logging\jboss-logging\3.3.0.Final\jboss-logging-3.3.0.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\fasterxml\classmate\1.3.3\classmate-1.3.3.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.7\jackson-databind-2.8.7.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.7\jackson-core-2.8.7.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-web\4.3.7.RELEASE\spring-web-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-beans\4.3.7.RELEASE\spring-beans-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-context\4.3.7.RELEASE\spring-context-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-webmvc\4.3.7.RELEASE\spring-webmvc-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-expression\4.3.7.RELEASE\spring-expression-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-undertow\1.5.2.RELEASE\spring-boot-starter-undertow-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\io\undertow\undertow-core\1.4.11.Final\undertow-core-1.4.11.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\xnio\xnio-api\3.3.6.Final\xnio-api-3.3.6.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\xnio\xnio-nio\3.3.6.Final\xnio-nio-3.3.6.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\io\undertow\undertow-servlet\1.4.11.Final\undertow-servlet-1.4.11.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\spec\javax\annotation\jboss-annotations-api_1.2_spec\1.0.0.Final\jboss-annotations-api_1.2_spec-1.0.0.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\io\undertow\undertow-websockets-jsr\1.4.11.Final\undertow-websockets-jsr-1.4.11.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\jboss\spec\javax\websocket\jboss-websocket-api_1.1_spec\1.1.0.Final\jboss-websocket-api_1.1_spec-1.1.0.Final.jar;C:\Users\Bryce.Chernecki\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\glassfish\javax.el\3.0.0\javax.el-3.0.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-test\1.5.2.RELEASE\spring-boot-starter-test-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-test\1.5.2.RELEASE\spring-boot-test-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-test-autoconfigure\1.5.2.RELEASE\spring-boot-test-autoconfigure-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;C:\Users\Bryce.Chernecki\.m2\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\slf4j\slf4j-api\1.7.24\slf4j-api-1.7.24.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-core\4.3.7.RELEASE\spring-core-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-test\4.3.7.RELEASE\spring-test-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-starter-security\1.5.2.RELEASE\spring-boot-starter-security-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\spring-aop\4.3.7.RELEASE\spring-aop-4.3.7.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\security\spring-security-config\4.2.2.RELEASE\spring-security-config-4.2.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\security\spring-security-core\4.2.2.RELEASE\spring-security-core-4.2.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\security\spring-security-web\4.2.2.RELEASE\spring-security-web-4.2.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-devtools\1.5.2.RELEASE\spring-boot-devtools-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot\1.5.2.RELEASE\spring-boot-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.2.RELEASE\spring-boot-autoconfigure-1.5.2.RELEASE.jar;C:\Users\Bryce.Chernecki\.m2\repository\tanukisoftware\wrapper\3.5.27\wrapper-3.5.27.jar;C:\Users\Bryce.Chernecki\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\mockito\mockito-all\1.10.19\mockito-all-1.10.19.jar;C:\Users\Bryce.Chernecki\.m2\repository\commons-configuration\commons-configuration\1.10\commons-configuration-1.10.jar;C:\Users\Bryce.Chernecki\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\Bryce.Chernecki\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-module-junit4\1.7.0\powermock-module-junit4-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-module-junit4-common\1.7.0\powermock-module-junit4-common-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-reflect\1.7.0\powermock-reflect-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-core\1.7.0\powermock-core-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-api-mockito\1.7.0\powermock-api-mockito-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-api-mockito-common\1.7.0\powermock-api-mockito-common-1.7.0.jar;C:\Users\Bryce.Chernecki\.m2\repository\org\powermock\powermock-api-support\1.7.0\powermock-api-support-1.7.0.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 com.qhrtech.freedom.util.PrinterUtilTest
java.lang.IllegalStateException: Failed to transform class with name javax.print.PrintServiceLookup. Reason: null
at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:296)
at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:204)
at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass1(DeferSupportingClassLoader.java:89)
at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:79)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:439)
at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:420)
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotation(Class.java:3415)
at java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:258)
at java.lang.Class.isAnnotationPresent(Class.java:3425)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$1.call(DelegatingPowerMockRunner.java:102)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$1.call(DelegatingPowerMockRunner.java:97)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.withContextClassLoader(DelegatingPowerMockRunner.java:132)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.createDelegate(DelegatingPowerMockRunner.java:96)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.<init>(DelegatingPowerMockRunner.java:64)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:172)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:48)
at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:108)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:71)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:36)
at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.NullPointerException
at javassist.bytecode.stackmap.TypeData$ClassName.getArrayType(TypeData.java:814)
at javassist.bytecode.stackmap.TypeData$TypeVar.fixTypes1(TypeData.java:400)
at javassist.bytecode.stackmap.TypeData$TypeVar.fixTypes(TypeData.java:392)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:338)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.TypeData$TypeVar.dfs(TypeData.java:321)
at javassist.bytecode.stackmap.MapMaker.fixTypes(MapMaker.java:390)
at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:167)
at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:108)
at javassist.bytecode.MethodInfo.rebuildStackMap(MethodInfo.java:456)
at javassist.bytecode.MethodInfo.rebuildStackMapIf6(MethodInfo.java:438)
at javassist.expr.ExprEditor.doit(ExprEditor.java:113)
at javassist.CtClassType.instrument(CtClassType.java:1465)
at org.powermock.core.transformers.impl.ClassMockTransformer.transformMockClass(ClassMockTransformer.java:65)
at org.powermock.core.transformers.impl.AbstractMainMockTransformer.transform(AbstractMainMockTransformer.java:62)
at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:277)
... 56 more
Process finished with exit code -1
My research of this error has brought about various suggestions that my project might have org.javassist dependency that is conflicting with Powermock's. I don't believe this to be the case as other static classes within PrepareForTest do not break tests. (specifically if the class is NOT part of the javax.print package) Below is my mvn dependency:tree command
web:jar:1.5.2.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.5.2.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.2.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.24:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.24:compile
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.24:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] | +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.7:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.7:compile
[INFO] | +- org.springframework:spring-web:jar:4.3.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.3.7.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:4.3.7.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.3.7.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.3.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-undertow:jar:1.5.2.RELEASE:compile
[INFO] | +- io.undertow:undertow-core:jar:1.4.11.Final:compile
[INFO] | | +- org.jboss.xnio:xnio-api:jar:3.3.6.Final:compile
[INFO] | | \- org.jboss.xnio:xnio-nio:jar:3.3.6.Final:runtime
[INFO] | +- io.undertow:undertow-servlet:jar:1.4.11.Final:compile
[INFO] | | \- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] | +- io.undertow:undertow-websockets-jsr:jar:1.4.11.Final:compile
[INFO] | | \- org.jboss.spec.javax.websocket:jboss-websocket-api_1.1_spec:jar:1.1.0.Final:compile
[INFO] | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] | \- org.glassfish:javax.el:jar:3.0.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.2.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:1.5.2.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.2.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] | | +- net.minidev:json-smart:jar:2.2.1:test
[INFO] | | | \- net.minidev:accessors-smart:jar:1.1:test
[INFO] | | | \- org.ow2.asm:asm:jar:5.0.3:test
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.24:compile
[INFO] | +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | | \- org.objenesis:objenesis:jar:2.1: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.4.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-core:jar:4.3.7.RELEASE:compile
[INFO] | \- org.springframework:spring-test:jar:4.3.7.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.5.2.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:4.3.7.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:4.2.2.RELEASE:compile
[INFO] | | \- org.springframework.security:spring-security-core:jar:4.2.2.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-web:jar:4.2.2.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:1.5.2.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:1.5.2.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.2.RELEASE:compile
[INFO] +- tanukisoftware:wrapper:jar:3.5.27:compile
[INFO] +- tanukisoftware:wrapper:dll:3.5.27:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] +- org.mockito:mockito-all:jar:1.10.19:test
[INFO] +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] | +- commons-lang:commons-lang:jar:2.6:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.powermock:powermock-module-junit4:jar:1.7.0:test
[INFO] | \- org.powermock:powermock-module-junit4-common:jar:1.7.0:test
[INFO] | +- org.powermock:powermock-reflect:jar:1.7.0:test
[INFO] | \- org.powermock:powermock-core:jar:1.7.0:test
[INFO] | \- org.javassist:javassist:jar:3.21.0-GA:test
[INFO] \- org.powermock:powermock-api-mockito:jar:1.7.0:test
[INFO] \- org.powermock:powermock-api-mockito-common:jar:1.7.0:test
[INFO] \- org.powermock:powermock-api-support:jar:1.7.0:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.044s
[INFO] Finished at: Tue Aug 01 11:57:22 MDT 2017
[INFO] Final Memory: 18M/304M
[INFO] ------------------------------------------------------------------------
Try making your test class extend PowerMockTestCase
Tests used to pass until last week and now it started failing. The error is displayed below.
rest-assured=2.9.0
httpclient-4.5.1.jar
httpcore-4.4.3.jar
I excluded the other httpclient and core jars from ivy these two above versions come from rest assured. Please I really need help with this.
import static com.jayway.restassured.RestAssured.given
#Test
public void getSummary(){
given().
contentType("application/json").
when().
get("http://example.org/ab/resources/client/case/123455").
then().
statusCode(200).
extract().path("id");
;
//statusCode(200);
}
java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
at com.jayway.restassured.config.EncoderConfig.(EncoderConfig.java:61)
at com.jayway.restassured.config.RestAssuredConfig.(RestAssuredConfig.java:41)
at com.jayway.restassured.RestAssured.(RestAssured.java:423)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at org.codehaus.groovy.runtime.callsite.CallSiteArray$1.run(CallSiteArray.java:68)
at org.codehaus.groovy.runtime.callsite.CallSiteArray$1.run(CallSiteArray.java:65)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:65)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:198)
at com.thomson.tssq.jwb.restapitests.RestAPITest.getSummary(RestAPITest.groovy:16)
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.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
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.runners.ParentRunner.run(ParentRunner.java:363)
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)
See if you have below listed jars in classpath or in maven pom.xml
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # rest-assured ---
[INFO] io.rest-assured:rest-assured:jar:3.0.2-SNAPSHOT
[INFO] +- org.codehaus.groovy:groovy:jar:2.4.6:compile
[INFO] +- org.codehaus.groovy:groovy-xml:jar:2.4.6:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile
[INFO] | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | \- commons-codec:commons-codec:jar:1.9:compile
[INFO] +- org.apache.httpcomponents:httpmime:jar:4.5.1:compile
[INFO] +- com.github.scribejava:scribejava-apis:jar:2.5.3:compile
[INFO] | \- com.github.scribejava:scribejava-core:jar:2.5.3:compile
[INFO] +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:compile
[INFO] +- io.rest-assured:json-path:jar:3.0.2-SNAPSHOT:compile
[INFO] | +- org.codehaus.groovy:groovy-json:jar:2.4.6:compile
[INFO] | \- io.rest-assured:rest-assured-common:jar:3.0.2-SNAPSHOT:compile
[INFO] +- io.rest-assured:xml-path:jar:3.0.2-SNAPSHOT:compile
[INFO] | \- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.7.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.7.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.7.3:compile
[INFO] +- org.codehaus.jackson:jackson-core-asl:jar:1.9.11:compile
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.11:compile
[INFO] +- com.google.code.gson:gson:jar:2.6.2:compile
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] \- org.assertj:assertj-core:jar:1.7.0:test
When I uncomment this line in this interface I get error while Spring run.
#Repository
public interface PersonRepository extends GraphRepository<Person>
{
//Person findByName(String name);
}
Output from run:
2016-06-08 23:27:58.580 INFO 6723 --- [ main] o.s.d.neo4j.mapping.Neo4jMappingContext : Neo4jMappingContext initialisation completed
2016-06-08 23:27:58.665 WARN 6723 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: hello.PersonRepository hello.HomeController.personRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.data.neo4j.repository.query.GraphQueryLookupStrategy.resolveQuery(Ljava/lang/reflect/Method;Lorg/springframework/data/repository/core/RepositoryMetadata;Lorg/springframework/data/repository/core/NamedQueries;)Lorg/springframework/data/repository/query/RepositoryQuery;
2016-06-08 23:27:58.671 INFO 6723 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2016-06-08 23:27:58.695 ERROR 6723 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: hello.PersonRepository hello.HomeController.personRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.data.neo4j.repository.query.GraphQueryLookupStrategy.resolveQuery(Ljava/lang/reflect/Method;Lorg/springframework/data/repository/core/RepositoryMetadata;Lorg/springframework/data/repository/core/NamedQueries;)Lorg/springframework/data/repository/query/RepositoryQuery;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at hello.Application.main(Application.java:26) [classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: hello.PersonRepository hello.HomeController.personRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.data.neo4j.repository.query.GraphQueryLookupStrategy.resolveQuery(Ljava/lang/reflect/Method;Lorg/springframework/data/repository/core/RepositoryMetadata;Lorg/springframework/data/repository/core/NamedQueries;)Lorg/springframework/data/repository/query/RepositoryQuery;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
... 17 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.data.neo4j.repository.query.GraphQueryLookupStrategy.resolveQuery(Ljava/lang/reflect/Method;Lorg/springframework/data/repository/core/RepositoryMetadata;Lorg/springframework/data/repository/core/NamedQueries;)Lorg/springframework/data/repository/query/RepositoryQuery;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
... 19 common frames omitted
Caused by: java.lang.AbstractMethodError: org.springframework.data.neo4j.repository.query.GraphQueryLookupStrategy.resolveQuery(Ljava/lang/reflect/Method;Lorg/springframework/data/repository/core/RepositoryMetadata;Lorg/springframework/data/repository/core/NamedQueries;)Lorg/springframework/data/repository/query/RepositoryQuery;
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:416) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:206) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:251) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:237) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
at org.springframework.data.neo4j.repository.support.GraphRepositoryFactoryBean.afterPropertiesSet(GraphRepositoryFactoryBean.java:43) ~[spring-data-neo4j-4.1.1.RELEASE.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
... 29 common frames omitted
2016-06-08 23:27:58.707 INFO 6723 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/home/marcin/Praca%20magisterska/spring_data_neo4j/neo4j_connection/target/classes/, file:/home/marcin/.m2/repository/org/springframework/boot/spring-boot-starter/1.3.5.RELEASE/spring-boot-starter-1.3.5.RELEASE.jar, file:/home/marcin/.m2/repository/org/springframework/boot/spring-boot/1.3.5.RELEASE/spring-boot-1.3.5.RELEASE.jar, file:/home/marcin/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.3.5.RELEASE/spring-boot-autoconfigure-1.3.5.RELEASE.jar, file:/home/marcin/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.3.5.RELEASE/spring-boot-starter-logging-1.3.5.RELEASE.jar, file:/home/marcin/.m2/repository/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar, file:/home/marcin/.m2/repository/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar, file:/home/marcin/.m2/repository/org/slf4j/jul-to-slf4j/1.7.21/jul-to-slf4j-1.7.21.jar, file:/home/marcin/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.21/log4j-over-slf4j-1.7.21.jar, file:/home/marcin/.m2/repository/org/springframework/spring-core/4.2.6.RELEASE/spring-core-4.2.6.RELEASE.jar, file:/home/marcin/.m2/repository/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar, file:/home/marcin/.m2/repository/org/springframework/data/spring-data-neo4j/4.1.1.RELEASE/spring-data-neo4j-4.1.1.RELEASE.jar, file:/home/marcin/.m2/repository/org/neo4j/neo4j-ogm-core/2.0.1/neo4j-ogm-core-2.0.1.jar, file:/home/marcin/.m2/repository/org/neo4j/neo4j-ogm-api/2.0.1/neo4j-ogm-api-2.0.1.jar, file:/home/marcin/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar, file:/home/marcin/.m2/repository/org/neo4j/neo4j-ogm-compiler/2.0.1/neo4j-ogm-compiler-2.0.1.jar, file:/home/marcin/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar, file:/home/marcin/.m2/repository/org/neo4j/neo4j-ogm-http-driver/2.0.1/neo4j-ogm-http-driver-2.0.1.jar, file:/home/marcin/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar, file:/home/marcin/.m2/repository/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar, file:/home/marcin/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar, file:/home/marcin/.m2/repository/org/springframework/data/spring-data-commons/1.11.4.RELEASE/spring-data-commons-1.11.4.RELEASE.jar, file:/home/marcin/.m2/repository/org/springframework/spring-beans/4.2.6.RELEASE/spring-beans-4.2.6.RELEASE.jar, file:/home/marcin/.m2/repository/org/springframework/spring-context/4.2.6.RELEASE/spring-context-4.2.6.RELEASE.jar, file:/home/marcin/.m2/repository/org/springframework/spring-aop/4.2.6.RELEASE/spring-aop-4.2.6.RELEASE.jar, file:/home/marcin/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/home/marcin/.m2/repository/org/springframework/spring-expression/4.2.6.RELEASE/spring-expression-4.2.6.RELEASE.jar, file:/home/marcin/.m2/repository/org/springframework/spring-tx/4.2.6.RELEASE/spring-tx-4.2.6.RELEASE.jar, file:/home/marcin/.m2/repository/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar, file:/home/marcin/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21.jar, file:/home/marcin/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.3.5.RELEASE/spring-boot-starter-web-1.3.5.RELEASE.jar, file:/home/marcin/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.3.5.RELEASE/spring-boot-starter-tomcat-1.3.5.RELEASE.jar, file:/home/marcin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.0.33/tomcat-embed-core-8.0.33.jar, file:/home/marcin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.0.33/tomcat-embed-el-8.0.33.jar, file:/home/marcin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.33/tomcat-embed-logging-juli-8.0.33.jar, file:/home/marcin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.33/tomcat-embed-websocket-8.0.33.jar, file:/home/marcin/.m2/repository/org/springframework/boot/spring-boot-starter-validation/1.3.5.RELEASE/spring-boot-starter-validation-1.3.5.RELEASE.jar, file:/home/marcin/.m2/repository/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar, file:/home/marcin/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/home/marcin/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar, file:/home/marcin/.m2/repository/com/fasterxml/classmate/1.1.0/classmate-1.1.0.jar, file:/home/marcin/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.6.6/jackson-databind-2.6.6.jar, file:/home/marcin/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.6.6/jackson-annotations-2.6.6.jar, file:/home/marcin/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.6.6/jackson-core-2.6.6.jar, file:/home/marcin/.m2/repository/org/springframework/spring-web/4.2.6.RELEASE/spring-web-4.2.6.RELEASE.jar, file:/home/marcin/.m2/repository/org/springframework/spring-webmvc/4.2.6.RELEASE/spring-webmvc-4.2.6.RELEASE.jar]
Implementation of class Person:
#NodeEntity
public class Person
{
#GraphId
private Long id;
private String name;
private Person() {}
public Person(String name) { this.name = name; }
(...)
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
I have expected that Spring generate code for findByName(String). I don't understand why it don't do that and I don't understand error returned by Java. Can anyone explain this problem?
--
Tree dependency from Maven:
$ mvn dependency:tree -Dverbose
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Neo4j-CMS 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # Neo4j-CMS ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] org.marcin:Neo4j-CMS:jar:0.0.1
[INFO] +- org.springframework.boot:spring-boot-starter:jar:1.3.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:1.3.5.RELEASE:compile
[INFO] | | +- (org.springframework:spring-core:jar:4.2.6.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-context:jar:4.2.6.RELEASE:compile - version managed from 4.2.5.RELEASE; omitted for duplicate)
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.5.RELEASE:compile
[INFO] | | \- (org.springframework.boot:spring-boot:jar:1.3.5.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.5.RELEASE:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] | | | +- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] | | | \- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.13; omitted for duplicate)
[INFO] | | +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] | | | \- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.20; omitted for duplicate)
[INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] | | | \- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.20; omitted for duplicate)
[INFO] | | \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.20; omitted for duplicate)
[INFO] | +- org.springframework:spring-core:jar:4.2.6.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.16:runtime
[INFO] +- org.springframework.data:spring-data-neo4j:jar:4.1.1.RELEASE:compile
[INFO] | +- org.neo4j:neo4j-ogm-core:jar:2.0.1:compile
[INFO] | | +- org.neo4j:neo4j-ogm-api:jar:2.0.1:compile
[INFO] | | | +- (com.fasterxml.jackson.core:jackson-databind:jar:2.6.6:compile - version managed from 2.7.1; omitted for duplicate)
[INFO] | | | +- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.14; omitted for duplicate)
[INFO] | | | \- commons-codec:commons-codec:jar:1.10:compile
[INFO] | | +- org.neo4j:neo4j-ogm-compiler:jar:2.0.1:compile
[INFO] | | | \- (org.neo4j:neo4j-ogm-api:jar:2.0.1:compile - omitted for duplicate)
[INFO] | | \- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | +- org.neo4j:neo4j-ogm-http-driver:jar:2.0.1:compile
[INFO] | | +- (org.neo4j:neo4j-ogm-api:jar:2.0.1:compile - omitted for duplicate)
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile (version managed from 4.3.6)
[INFO] | | | +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile
[INFO] | | | \- (commons-codec:commons-codec:jar:1.9:compile - omitted for conflict with 1.10)
[INFO] | | \- commons-io:commons-io:jar:2.4:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.11.4.RELEASE:compile (version managed from 1.12.1.RELEASE)
[INFO] | | +- (org.springframework:spring-core:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | | +- org.springframework:spring-beans:jar:4.2.6.RELEASE:compile
[INFO] | | | \- (org.springframework:spring-core:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.19; omitted for duplicate)
[INFO] | | \- (org.slf4j:jcl-over-slf4j:jar:1.7.21:runtime - version managed from 1.7.13; omitted for duplicate)
[INFO] | +- org.springframework:spring-context:jar:4.2.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.2.6.RELEASE:compile
[INFO] | | | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | | +- (org.springframework:spring-beans:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | | | \- (org.springframework:spring-core:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | | +- (org.springframework:spring-core:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | | \- org.springframework:spring-expression:jar:4.2.6.RELEASE:compile
[INFO] | | \- (org.springframework:spring-core:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | +- org.springframework:spring-tx:jar:4.2.6.RELEASE:compile (version managed from 4.2.5.RELEASE)
[INFO] | | +- (org.springframework:spring-beans:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | | \- (org.springframework:spring-core:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] | \- (org.slf4j:jcl-over-slf4j:jar:1.7.21:compile - version managed from 1.7.19; scope updated from runtime; omitted for duplicate)
[INFO] \- org.springframework.boot:spring-boot-starter-web:jar:1.3.5.RELEASE:compile
[INFO] +- (org.springframework.boot:spring-boot-starter:jar:1.3.5.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.3.5.RELEASE:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.33:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.33:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.33:compile
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.33:compile
[INFO] | \- (org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.33:compile - omitted for duplicate)
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:1.3.5.RELEASE:compile
[INFO] | +- (org.springframework.boot:spring-boot-starter:jar:1.3.5.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.33:compile - omitted for duplicate)
[INFO] | \- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile (version managed from 3.2.1.Final)
[INFO] | \- com.fasterxml:classmate:jar:1.1.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.6:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.6:compile (version managed from 2.6.0)
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.6.6:compile
[INFO] +- org.springframework:spring-web:jar:4.2.6.RELEASE:compile
[INFO] | +- (org.springframework:spring-aop:jar:4.2.6.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:4.2.6.RELEASE:compile - version managed from 4.2.5.RELEASE; omitted for duplicate)
[INFO] | \- (org.springframework:spring-core:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] \- org.springframework:spring-webmvc:jar:4.2.6.RELEASE:compile
[INFO] +- (org.springframework:spring-beans:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] +- (org.springframework:spring-context:jar:4.2.6.RELEASE:compile - version managed from 4.2.5.RELEASE; omitted for duplicate)
[INFO] +- (org.springframework:spring-core:jar:4.2.6.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] +- (org.springframework:spring-expression:jar:4.2.6.RELEASE:compile - omitted for duplicate)
[INFO] \- (org.springframework:spring-web:jar:4.2.6.RELEASE:compile - omitted for duplicate)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.367 s
[INFO] Finished at: 2016-06-09T22:07:03+02:00
[INFO] Final Memory: 21M/339M
[INFO] ------------------------------------------------------------------------
The version of Spring Data Commons is the problem. If you stick with the release train that SDN 4.1.1 belongs to (Hopper SR1), then you should be fine.
This shows you how to do it:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>Hopper-SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
I have recently upgraded to Spring-Data-Neo4j 4.1.0-BUILD-SNAPSHOT (using neo4j-ogm 2.0.0-M01) and noticed that queries retrieving a #QueryResult are not working any more. I get the following error:
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)
The #QueryResult Object:
#QueryResult
public class Participant {
private Long ewasDbId;
private String ewasName;
private Collection<Long> refEntityDbIds;
private Collection<String> refEntityNames;
}
The Query:
#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);
The Dependencies:
<!--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>
...
Dependency tree
[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
Am I doing something wrong or is this an issue that will be fixed in the future?
Thanks for your help
Not sure how this happened, but it looks like it wants the neo4j-ogm 2.0.0-SNAPSHOT
Could you either do a mvn clean -U ... and see if it fixes the problem, or use the neo4j-ogm snapshot? You'll need to include
<repository>
<id>neo4j-snapshots</id>
<url>http://m2.neo4j.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
Update
Your dependency tree includes mixed versions
+- 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
It should either have 2.0.0-M01 or 2.0.0-SNAPSHOT but not both, because they are incompatible when it comes to the QueryResult.
Perhaps delete 2.0.0-M01 and 2.0.0-SNAPSHOT from your local maven repository (org/neo4j/neo4j-ogm) and force an update with mvn -U ?