Проблема связывания вместе spring-data-neo4j автономный проект spring

Я пытаюсь создать песочницу, используя Spring для обработки внедрения зависимостей. Моя песочница состоит из нескольких доменных классов, а также MainClass, в котором есть метод main(String[] args).

В аннотации моего TestClassс помощью @Component, и он просто содержит

@Autowired
private Neo4jTemplate neo4jTemplate;

.

В моем методе mainя вызываю ClassPathXmlApplicationContextв моем файле applicationContext.xml, который состоит из:

<context:annotation-config/>
<context:spring-configured/>
<context:component-scan base-package="org.neuralsandbox"/>

<neo4j:config storeDirectory="data/sandbox.db"/>

, но моя программа не выполнить в строке здесь я объявляю свой ClassPathXmlApplicationContext, с массивной трассировкой стека, я распечатаю первый и последний броски.

Первый:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testClass': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.data.neo4j.support.Neo4jTemplate org.neuralsandbox.TestClass.neo4jTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jTemplate' defined in class org.springframework.data.neo4j.config.Neo4jConfiguration: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public final org.springframework.data.neo4j.support.Neo4jTemplate org.springframework.data.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$a3874640.neo4jTemplate() throws java.lang.Exception] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mappingInfrastructure' defined in class org.springframework.data.neo4j.config.Neo4jConfiguration: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public final org.springframework.data.neo4j.support.MappingInfrastructure org.springframework.data.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$a3874640.mappingInfrastructure() throws java.lang.Exception] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jTransactionManager' defined in class org.springframework.data.neo4j.config.Neo4jConfiguration: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public final org.springframework.transaction.PlatformTransactionManager org.springframework.data.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$a3874640.neo4jTransactionManager()] threw exception; nested exception is java.lang.NoSuchMethodError: org.neo4j.kernel.impl.transaction.UserTransactionImpl.<init>(Lorg/neo4j/graphdb/GraphDatabaseService;)V
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1073)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at org.neuralsandbox.MainClass.main(MainClass.java:8)

Последний:

Caused by: java.lang.NoSuchMethodError: org.neo4j.kernel.impl.transaction.UserTransactionImpl.<init>(Lorg/neo4j/graphdb/GraphDatabaseService;)V
    at org.springframework.data.neo4j.config.Neo4jConfiguration.createJtaTransactionManager(Neo4jConfiguration.java:240)
    at org.springframework.data.neo4j.config.Neo4jConfiguration.neo4jTransactionManager(Neo4jConfiguration.java:232)
    at org.springframework.data.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$a3874640.CGLIB$neo4jTransactionManager$21(<generated>)
    at org.springframework.data.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$a3874640$$FastClassByCGLIB$$ed4fda1e.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:210)
    at org.springframework.data.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$a3874640.neo4jTransactionManager(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:145)
    ... 72 more

Я использую neo4j 1.7 и spring-data-neo4j 2.0.0.RELEASE, а также spring 3.1.0.RELEASE.

Я не нашел веских причин, используя учебные пособия, представленные на сайте spring-data-neo4j, по которым это исключение было бы выдано. Кто-нибудь может помочь?

6
задан Nicholas 25 May 2012 в 03:37
поделиться