Announcement Announcement Module
Collapse
No announcement yet.
[neo4j] error when starting server plugin Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [neo4j] error when starting server plugin

    I'm trying to create a server plugin, and have not been able to successfully start the Neo4j server with a plugin jar that I have created.


    Code:
    SEVERE: 
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Cannot resolve reference to bean 'neo4jTemplate' while setting bean property 'neo4jTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'neo4jTemplate' is defined
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:591)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
    	at org.springframework.data.neo4j.server.ProvidedClassPathXmlApplicationContext.<init>(ProvidedClassPathXmlApplicationContext.java:36)
    	at org.springframework.data.neo4j.server.SpringPluginInitializer.start(SpringPluginInitializer.java:65)
    	at org.neo4j.server.modules.PluginInitializer.initializePackages(PluginInitializer.java:64)
    	at org.neo4j.server.AbstractNeoServer.getInjectables(AbstractNeoServer.java:440)
    	at org.neo4j.server.web.Jetty6WebServer.addJAXRSPackages(Jetty6WebServer.java:208)
    	at org.neo4j.server.modules.ThirdPartyJAXRSModule.start(ThirdPartyJAXRSModule.java:53)
    	at org.neo4j.server.AbstractNeoServer.startModules(AbstractNeoServer.java:143)
    	at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:112)
    	at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:79)
    	at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:46)
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'neo4jTemplate' is defined
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:553)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
    	... 22 more

    I have basically adapted what is on Michael Hunger's Neo4j Guidebook.


    Code:
    public class HelloWorldInitializer extends SpringPluginInitializer {
        public HelloWorldInitializer() {
            super(new String[]{"spring/helloWorldServer-Context.xml"},
                  Pair.of("worldRepository", WorldRepository.class),
                  Pair.of("template", Neo4jTemplate.class));
        }
    }
    What should the spring configuration look like for a server plugin? This is what I am using

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="
           	http://www.springframework.org/schema/beans 
           	http://www.springframework.org/schema/beans/spring-beans.xsd
    		http://www.springframework.org/schema/context 
    		http://www.springframework.org/schema/context/spring-context.xsd
    		http://www.springframework.org/schema/data/neo4j
    		http://www.springframework.org/schema/data/neo4j/spring-neo4j-2.0.xsd
    		http://www.springframework.org/schema/tx
    		http://www.springframework.org/schema/tx/spring-tx.xsd">
    
    	<context:spring-configured/>
        <context:annotation-config/>
        <context:component-scan base-package="org.jarebu.neo4j.spring.domain" />
    
        <neo4j:repositories base-package="org.jarebu.neo4j.spring.repositories"/>
        
    	<tx:annotation-driven />
    </beans>
    Any suggestions?

  • #2
    jarebu,

    I think you are missing a
    Code:
    <neo4j:config storeDirectory="foo" />
    - try if that helps.

    Regards,

    Lasse

    Comment


    • #3
      lasse,

      yep, my mistake, it works now

      thanks for spotting that!

      Comment

      Working...
      X