SDN4 Config - java.lang.annotation.AnnotationFormatError: Invalid default: …EnableNeo4jRepositories.repositoryBaseClass()

痴心易碎 提交于 2019-12-12 17:15:11

问题


I'm getting the following error with Spring Data Neo4j 4. I think it could be a dependency conflict but I'm not sure what.

java.lang.IllegalStateException: Failed to load ApplicationContext  at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)   at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)    at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:183)  at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:123)     at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228)     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:217)     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:276)    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:278)    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:236)   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87)    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.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:180)    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)  at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)  at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)  at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\*****\*****-spa\core\target\test-classes\nz\co\*****\TestNeo4jConfig.class]; nested exception is java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories.repositoryBaseClass()

The highlight of the above seems to be.

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\thescene\thescene-spa\core\target\test-classes\nz\co\thescene\TestNeo4jConfig.class]; nested exception is java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories.repositoryBaseClass()

My spring dependencies are:

[INFO] +- org.springframework:spring-beans:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework:spring-expression:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.0.M5:compile
[INFO] +- org.springframework.boot:spring-boot-starter-aop:jar:1.3.0.M5:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.2.6.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.2.6.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.6.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-crypto:jar:3.2.7.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-neo4j:jar:4.0.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-tx:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-commons:jar:1.9.2.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-neo4j:test-jar:tests:4.0.0.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.3.0.M5:test
[INFO] +- org.springframework:spring-test:jar:4.2.1.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.2.6.RELEASE:compile
[INFO] |  \- org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.6.RELEASE:compile
[INFO] +- org.springframework.security.oauth:spring-security-oauth2:jar:2.0.7.RELEASE:compile
[INFO] |  +- org.springframework.security:spring-security-core:jar:4.0.2.RELEASE:compile
[INFO] |  +- org.springframework.security:spring-security-config:jar:4.0.2.RELEASE:compile
[INFO] |  +- org.springframework.security:spring-security-web:jar:4.0.2.RELEASE:compile
[INFO] \- org.springframework.social:spring-social-core:jar:1.2.0.BUILD-SNAPSHOT:compile

My neo4j dependencies are:

[INFO] +- org.springframework.data:spring-data-neo4j:jar:4.0.0.RELEASE:compile
[INFO] |  +- org.neo4j:neo4j-ogm:jar:1.1.2:compile
[INFO] +- org.neo4j:neo4j-kernel:jar:2.2.5:compile
[INFO] |  +- org.neo4j:neo4j-primitive-collections:jar:2.2.5:compile
[INFO] |  \- org.neo4j:neo4j-csv:jar:2.2.5:compile
[INFO] +- org.neo4j:neo4j-io:jar:2.2.5:compile
[INFO] |  \- org.neo4j:neo4j-unsafe:jar:2.2.5:compile
[INFO] +- org.neo4j.test:neo4j-harness:jar:2.2.5:test
[INFO] |  +- org.neo4j.app:neo4j-server:jar:2.2.5:compile
[INFO] |  |  +- org.neo4j:neo4j-cypher:jar:2.2.5:compile
[INFO] |  |  |  +- org.neo4j:neo4j-lucene-index:jar:2.2.5:compile
[INFO] |  |  |  +- org.neo4j:neo4j-graph-matching:jar:2.2.5:compile
[INFO] |  |  |  +- org.neo4j:neo4j-graph-algo:jar:2.2.5:compile
[INFO] |  |  |  +- org.neo4j:neo4j-cypher-compiler-1.9:jar:2.0.4:compile
[INFO] |  |  |  +- org.neo4j:neo4j-cypher-compiler-2.0:jar:2.0.4:compile
[INFO] |  |  |  +- org.neo4j:neo4j-cypher-compiler-2.1:jar:2.1.8:compile
[INFO] |  |  |  +- org.neo4j:neo4j-cypher-compiler-2.2:jar:2.2.5:compile
[INFO] |  |  +- org.neo4j.app:neo4j-browser:jar:2.2.5:compile
[INFO] |  |  \- org.neo4j:neo4j-shell:jar:2.2.5:compile
[INFO] |  +- org.neo4j:neo4j-kernel:test-jar:tests:2.2.5:test
[INFO] |  +- org.neo4j:neo4j-io:test-jar:tests:2.2.5:test
[INFO] +- org.springframework.data:spring-data-neo4j:test-jar:tests:4.0.0.RELEASE:test
[INFO] +- org.neo4j:neo4j-ogm:test-jar:tests:1.1.2:test
[INFO] |  \- org.neo4j:server-api:jar:2.2.5:compile
[INFO] |     \- org.neo4j.3rdparty.javax.ws.rs:jsr311-api:jar:1.1.2.r612:compile

Here are all the rest:

[INFO] nz.co.*****:*****-core:jar:0.0.1-SNAPSHOT
[INFO] +- nz.co.*****:*****-model:jar:0.0.1-SNAPSHOT:compile
[INFO] |  \- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] |     +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |     +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] |     \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  +- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] |  |  \- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] |  +- org.slf4j:jul-to-slf4j:jar:1.7.12:compile
[INFO] |  \- org.slf4j:log4j-over-slf4j:jar:1.7.12:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.14:compile
[INFO] |  +- org.aspectj:aspectjrt:jar:1.8.6:compile
[INFO] |  \- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] +- com.voodoodyne.jackson.jsog:jackson-jsog:jar:1.1:compile
[INFO] +- org.projectlombok:lombok:jar:1.16.4:compile
[INFO] +- com.squareup.okhttp:okhttp:jar:2.5.0:compile
[INFO] |  \- com.squareup.okio:okio:jar:1.6.0:compile
[INFO] |  |  |  +- org.scala-lang:scala-library:jar:2.10.5:compile
[INFO] |  |  |  +- org.scala-lang:scala-reflect:jar:2.10.5:compile
[INFO] |  |  |  |  \- org.apache.lucene:lucene-core:jar:3.6.2:compile
[INFO] |  |  |  +- org.parboiled:parboiled-scala_2.10: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:compile
[INFO] |  |  +- ch.qos.logback:logback-access:jar:1.1.3:compile
[INFO] |  |  +- org.codehaus.janino:janino:jar:2.6.1:compile
[INFO] |  |  |  \- org.codehaus.janino:commons-compiler:jar:2.6.1:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-server:jar:9.2.13.v20150730:compile
[INFO] |  |  |  +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] |  |  |  +- org.eclipse.jetty:jetty-http:jar:9.2.13.v20150730:compile
[INFO] |  |  |  |  \- org.eclipse.jetty:jetty-util:jar:9.2.13.v20150730:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-io:jar:9.2.13.v20150730:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-webapp:jar:9.2.13.v20150730:compile
[INFO] |  |  |  +- org.eclipse.jetty:jetty-xml:jar:9.2.13.v20150730:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.2.13.v20150730:compile
[INFO] |  |  |     \- org.eclipse.jetty:jetty-security:jar:9.2.13.v20150730:compile
[INFO] |  |  +- com.sun.jersey:jersey-server:jar:1.13:compile
[INFO] |  |  |  \- asm:asm:jar:3.1:compile
[INFO] |  |  +- com.sun.jersey:jersey-servlet:jar:1.13:compile
[INFO] |  |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.13:compile
[INFO] |  |  +- org.rrd4j:rrd4j:jar:2.2:compile
[INFO] |  |  +- org.mozilla:rhino:jar:1.7R4:compile
[INFO] |  |  +- bouncycastle:bcprov-jdk16:jar:140:compile
[INFO] |  |  +- com.sun.jersey.contribs:jersey-multipart:jar:1.19:compile
[INFO] |  |  |  \- org.jvnet.mimepull:mimepull:jar:1.9.3:compile
[INFO] |  |     \- org.apache.servicemix.bundles:org.apache.servicemix.bundles.jline:jar:0.9.94_1:compile
[INFO] |  +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] |  +- commons-digester:commons-digester:jar:2.1:compile
[INFO] |  |  \- commons-beanutils:commons-beanutils:jar:1.9.2:compile
[INFO] |  \- com.sun.jersey:jersey-client:jar:1.13:test
[INFO] |     \- com.sun.jersey:jersey-core:jar:1.13:compile
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] +- org.jasypt:jasypt:jar:1.9.2:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-json-org:jar:2.5.0:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.5.4:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.5.4:compile
[INFO] |  \- org.apache.geronimo.bundles:json:jar:20090211_1:compile
[INFO] +- com.thoughtworks.xstream:xstream:jar:1.4.2:compile
[INFO] |  +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] |  \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.4:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.3.2:compile
[INFO] |  |  \- org.apache.httpcomponents:httpcore:jar:4.4.1:compile
[INFO] |  \- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  +- org.mockito:mockito-core:jar:2.0.2-beta: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] +- junit:junit:jar:4.12:test
[INFO] +- org.hamcrest:hamcrest-all:jar:1.3:compile
[INFO] +- org.jbehave:jbehave-core:jar:4.0.1:test
[INFO] |  +- org.hamcrest:hamcrest-integration:jar:1.3:test
[INFO] |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  +- commons-io:commons-io:jar:2.4:compile
[INFO] |  +- org.codehaus.plexus:plexus-utils:jar:3.0.10:test
[INFO] |  +- org.freemarker:freemarker:jar:2.3.22:test
[INFO] |  \- com.thoughtworks.paranamer:paranamer:jar:2.4:test
[INFO] +- org.jbehave:jbehave-gherkin:jar:4.0.3:compile
[INFO] |  \- info.cukes:gherkin:jar:2.11.2:compile
[INFO] +- nz.co.*****:*****-server-plugins:jar:0.0.1-SNAPSHOT:test
[INFO] |     +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.26:compile
[INFO] |     +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.26:compile
[INFO] |     +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.26:compile
[INFO] |     \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.26:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.6:compile
[INFO] |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] |     \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile

Does anybody have any idea on how to solve this? Does anybody see anything amiss?


回答1:


I solved this in the end. I was importing the wrong version of spring-data-commons.



来源:https://stackoverflow.com/questions/33002474/sdn4-config-java-lang-annotation-annotationformaterror-invalid-default-en

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!