I've been trying to get this simple example running (with java 1.7) https://github.com/spring-guides/gs-accessing-neo4j-data-rest/tree/master/complete
I keep getting the following error when attempting to start the application via the main method in the Application class.
I'uploaded the entire log to this gist: http://bit.ly/1hU7Vpu
Here's the summary of the error.
WARN 6470 --- [ main] o.s.boot.SpringApplication : Error handling failed (Error creating bean with name 'org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.setBeanFactory(Lorg/springframework/beans/factory/BeanFactory;)V)
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityFetchHandler' defined in class hello.Application: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.data.neo4j.support.mapping.Neo4jEntityFetchHandler org.springframework.data.neo4j.config.Neo4jConfiguration.entityFetchHandler() throws java.lang.Exception] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nodeStateTransmitter' defined in class hello.Application: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
I think that you are seeing a Spring version conflict. See the following line in your error log:
exception is java.lang.NoSuchMethodError: org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.setBeanFactory(Lorg/springframework/beans/factory/BeanFactory;)V)
You should be able to prevent this error by removing the following line (you might not need it anyway):
@Import(RepositoryRestMvcConfiguration.class)
Can you show the output of mvn dependency:tree
? There might be duplicate Spring libs on your classpath.
EDIT:
It appears that it's the snapshot release of SDN that's causing the issue. Use
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>3.0.1.RELEASE</version>
</dependency>
instead of
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>3.1.0.BUILD-SNAPSHOT</version>
</dependency>
You might have found a bug!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.