Announcement Announcement Module
Collapse
No announcement yet.
Problem configuring spring-data-neo4j cross-store support Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem configuring spring-data-neo4j cross-store support

    Hey people!

    I'm having a curious problem when trying to configure the spring-data-neo4j with the cross-store support enabled. Everything is fine, except when I add the entityManagerFactory attribute to the <neo4j:config /> element to enable the cross-store support, then I get the following error during app bootstrap:

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.neo4j.config.Neo4jConfiguration#0': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'entityManagerFactory' of bean class [org.springframework.data.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$3f3c4ea8]: Bean property 'entityManagerFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
    	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:585)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    	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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Looks like something is wrong with the type of Bean it's been created for the Neo4J configuration. It's supposed to be a subclass of Neo4jConfiguration (where the entityManagerFactory field exists) when cross-store is needed, isn't it?

    My app has the following specs:

    Code:
    spring-{core,aop,aspects,beans,context,context-support,expression,jdbc,orm,oxm,web,webmvc}-3.1.0.RELEASE
    spring-data-commons-core-1.2.0.RELEASE
    spring-data-{neo4j,neo4j-rest}-2.0.0.RELEASE
    hibernate-{core,entitymanager}-3.6.9
    Other dependencies were omitted, but mainly I'm using PostgreSQL9 with Postgis support, Joda Time, and a bunch of other libraries I've already used before with success (always with Spring).

    I'm using Maven and Eclipse. In my pom.xml I have the AspectJ (org.codehaus.mojo:aspectj-maven-plugin-1.4) and the Eclipse (org.apache.maven.plugins:maven-eclipse-plugin-2.8) plugins. My project shows in Eclipse as a Web project and as an AspectJ project too (that means the maven Eclipse plugin is working as expected, I guess). In my AspectJ plugin I have the spring-aspects library configured.

    I'm using Tomcat 6.0.32 and the spring-agent is configured at startup time as a jvm argument.

    Code:
    	<neo4j:config graphDatabaseService="graphDatabaseService" entityManagerFactory="entityManagerFactory" />
    
    	<bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase">
    		<constructor-arg index="0" value="http://server-ip:7474/db/data" />
    		<constructor-arg index="1" value="******" />
    		<constructor-arg index="2" value="******" />
    	</bean>
    On other spring file (loaded before the neo4j one) I have:
    Code:
    <context:annotation-config /> and
    <context:load-time-weaver />
    If anyone need more details, just ask me.

    Is there anyone to help me out on this one? I have experience with Spring since 1.2 but I'm having a hard time on this one!!!

    Kind regards,

    Daniel

  • #2
    You chose the most tricky setup possible

    Actually so far I only used cross-store deployment with embedded Neo4j.

    Also my tests so far only run on Spring 3.0.7 can you try to run your setup on 3.0.6 or 3.0.7 to see if the issue is related to the spring version?

    It would also be great if you could share your spring project with me to help me figure out the issue.

    Thanks a lot

    Michael

    Comment


    • #3
      Dear Michael,

      Thank you very much for your reply. Your post make me think again and I decided to take a step back (I should've done this since the decision of using neo4j, sorry about that) and configure a simple POC instead of apply spring-data-neo4j on a already big project. Unfortunately the real project I can't share with you because of it's private nature, but I was able to reproduce the exception on the POC too. The exception I reported before is gone, it was my fault (missed the dependency spring-data-neo4j-cross-store and spring-data-neo4j-aspects).

      Now my app is starting just fine. However I'm having a hard time with Eclipse+Maven+AspectJ. My @NodeEntity is not being advised in Eclipse (only when I build the .war with Maven). I've googled it, found some topics on that matter (such as https://github.com/SpringSource/spri...eo4j/issues/13) but no success until now. I shared the POC on my dropbox, any help would be greatly appreciated!
      http://dl.dropbox.com/u/31758317/t2g-poc-neo4j.zip

      [Update] I forgot to mention, but I did fallback to spring-3.0.7. Apparently the spring-3.1.0 was not the reason nor the REST database service (I had the same exception using an Embedded neo4j service). Anyway, the POC is using spring-3.0.7.

      Kind regards,

      Daniel
      Last edited by daniel.rochetti; Jan 4th, 2012, 01:28 PM.

      Comment


      • #4
        Daniel,

        did you look into this: http://static.springsource.org/sprin.../html/#d0e1504

        Which eclipse version are you using?

        Is the project an AJ project? There should be a little AJ on the project icon. Otherwise you have to enable it.

        There might be some issues with the eclipse maven plugin not adding AspectJ files correctly to the build path. If you encounter issues, please try the following: Try editing the build path to include **/*.aj for the spring-data-neo4j project. You can do this by selecting "Build Path -> Configure Build Path ..." from the Package Explorer. Then for the spring-data-neo4j/src/main/java add **/*.aj to the Included path. For importing an Spring Data Graph project into Eclipse with m2e. Please make sure that the AspectJ Configurator is installed and activated.
        Last edited by MichaelHunger; Jan 5th, 2012, 03:52 AM.

        Comment

        Working...
        X