Announcement Announcement Module
No announcement yet.
Problem configuring spring-data-neo4j cross-store support Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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:

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name '': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'entityManagerFactory' of bean class [$$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.web.context.ContextLoader.configureAndRefreshWebApplicationContext(
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(
    	at org.apache.catalina.core.StandardContext.listenerStart(
    	at org.apache.catalina.core.StandardContext.start(
    	at org.apache.catalina.core.ContainerBase.start(
    	at org.apache.catalina.core.StandardHost.start(
    	at org.apache.catalina.core.ContainerBase.start(
    	at org.apache.catalina.core.StandardEngine.start(
    	at org.apache.catalina.core.StandardService.start(
    	at org.apache.catalina.core.StandardServer.start(
    	at org.apache.catalina.startup.Catalina.start(
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    	at java.lang.reflect.Method.invoke(
    	at org.apache.catalina.startup.Bootstrap.start(
    	at org.apache.catalina.startup.Bootstrap.main(
    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:

    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.

    	<neo4j:config graphDatabaseService="graphDatabaseService" entityManagerFactory="entityManagerFactory" />
    	<bean id="graphDatabaseService" class="">
    		<constructor-arg index="0" value="http://server-ip:7474/db/data" />
    		<constructor-arg index="1" value="******" />
    		<constructor-arg index="2" value="******" />
    On other spring file (loaded before the neo4j one) I have:
    <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,


  • #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



    • #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 but no success until now. I shared the POC on my dropbox, any help would be greatly appreciated!

      [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,

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


      • #4

        did you look into this:

        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, 02:52 AM.