Results 1 to 6 of 6

Thread: Spring Data Neo4j-java.lang.IllegalStateException

  1. #1
    Join Date
    Jul 2012
    Posts
    3

    Default Spring Data Neo4j-java.lang.IllegalStateException

    I tried configuring SDN in a test application that already has hibernate in it. But i get the following exception.

    Code:
    Caused by: java.lang.IllegalStateException: Singleton 'nodeEntityStateFactory' isn't currently in creation
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.afterSingletonCreation(DefaultSingletonBeanRegistry.java:312)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:239)
    	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.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:292)
    	at org.springframework.data.neo4j.cross_store.config.CrossStoreNeo4jConfiguration$$EnhancerByCGLIB$$43422e3d.nodeEntityStateFactory(<generated>)
    	at org.springframework.data.neo4j.config.Neo4jConfiguration.mappingContext(Neo4jConfiguration.java:199)
    	at org.springframework.data.neo4j.cross_store.config.CrossStoreNeo4jConfiguration$$EnhancerByCGLIB$$43422e3d.CGLIB$mappingContext$11(<generated>)
    	at org.springframework.data.neo4j.cross_store.config.CrossStoreNeo4jConfiguration$$EnhancerByCGLIB$$43422e3d$$FastClassByCGLIB$$1abce23b.invoke(<generated>)
    	at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:280)
    	at org.springframework.data.neo4j.cross_store.config.CrossStoreNeo4jConfiguration$$EnhancerByCGLIB$$43422e3d.mappingContext(<generated>)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:149)

    My application context has following configurations:

    Code:
     
    <neo4j:repositories base-package="com.Neuverd.repo*" neo4j-template-ref="template"/>
    <neo4j:config storeDirectory="c:/neo4j/data"  entityManagerFactory="entityManagerFactory"/> 
    
    <beans:bean id="template" class="org.springframework.data.neo4j.support.Neo4jTemplate" >
    <beans:constructor-arg ref="graphDatabase"/>
    </beans:bean>
    
    <beans:bean id="graphDatabase" class="org.springframework.data.neo4j.support.DelegatingGraphDatabase">
    <constructor-arg ref="graphDatabaseService"/>
    </beans:bean>
    
    <beans:bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
    <constructor-arg index="0" value="c:/neo4j/data" />
    </beans:bean>
    I have entityManagerFactory defined. I couldn't find any help from the docs or Google.

    If someone could help

  2. #2
    Join Date
    May 2012
    Posts
    107

    Default

    Shazin,

    I can't spot the problem off hand; could you share a small example project that reproduces the problem? (Preferably maven-based, via Github)

    Then I'd be happy to take a look.

    Lasse

  3. #3
    Join Date
    Jul 2012
    Posts
    3

    Default

    Yea, i have created a small project. It has a login a page, home page and user registration page. When the user registers, the user is added to both sql and graph database.

    These aren't going to bother you as the application fails on start up. Here is the github project

  4. #4
    Join Date
    May 2012
    Posts
    107

    Default

    Shazin,

    https://github.com/shazinahmed/SDN-T...ionContext.xml, line 36: change to <neo4j:config storeDirectory="c:/neo4j/data"/> and it seems to go a bit further (I didn't actually get it up and running, couldn't be bothered to install MySQL, but at least it doesn't go into an infite loop anymore )

    HTH!

    Lasse

  5. #5
    Join Date
    Jul 2012
    Posts
    3

    Default

    Hey Lasse,

    Thanks a lot for that bit of help. It really made my day. But now i have couple of doubts regarding this (just out of curiosity).

    1. I did inject entityManagerFactory as it was mentioned in the documentation for cross store persistence. So is the documentation wrong or the way I did it is wrong?

    2. In the documentation there is an example of transaction management using JTA with JOTM. This throws a null pointer exception, which i couldn't resolve. The error was discussed by another user here. Again, is it something unresolved or a mistake from my part?

    Thanks in advance,

    Cheers

    Shazin

    PS: I was not keeping well for last two days, so couldn't update you on time And yea, if you can post this answer for my SO question, I can accept it.
    Last edited by shazinahmed; Sep 16th, 2012 at 12:20 AM.

  6. #6
    Join Date
    May 2012
    Posts
    107

    Default

    Shazin,

    Sorry for the delay, travel and scheduling has kept me busy.

    Also apologies in advance for this brief answer: I find it best to refer to (continuously integrated) code for this stuff, and I know Good Relations does too. We have an example test here which is continuously built and tested: https://github.com/SpringSource/spri...ext-config.xml

    In there there is mention of a SharedEntityManagerCreator, maybe that is the root cause?

    Anyway that example works and is exercised regularly, so I would refer to that as the source of truth. If the manual doesn't reflect this properly, I'd love to get some concrete feedback on how we can improve it (indeed, we gladly accept pul requests )

    So, the reason for this evasive answer is, I haven't actually looked into cross-store stuff yet. So I'd love to hear your input.

    Regards,

    Lasse

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •