Announcement Announcement Module
Collapse
No announcement yet.
Cannot run Spring Data Neo4j-based WAR - NullPointerException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot run Spring Data Neo4j-based WAR - NullPointerException

    Hi,

    I have a problem getting Spring Data Neo4j-based web application running, constantly getting an exception seen in the log output below:
    Code:
    Caused by: java.lang.NullPointerException
    	at org.springframework.data.neo4j.support.DelegatingGraphDatabase.getIndex(DelegatingGraphDatabase.java:130)
    	at org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory.isAlreadyIndexed(TypeRepresentationStrategyFactory.java:61)
    	at org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory.chooseStrategy(TypeRepresentationStrategyFactory.java:54)
    	at org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory.<init>(TypeRepresentationStrategyFactory.java:39)
    	at org.springframework.data.neo4j.config.Neo4jConfiguration.typeRepresentationStrategyFactory(Neo4jConfiguration.java:143)
    	at org.springframework.data.neo4j.aspects.config.Neo4jAspectConfiguration$$EnhancerByCGLIB$$8e72a26.CGLIB$typeRepresentationStrategyFactory$12(<generated>)
    	at org.springframework.data.neo4j.aspects.config.Neo4jAspectConfiguration$$EnhancerByCGLIB$$8e72a26$$FastClassByCGLIB$$d632dcc3.invoke(<generated>)
    	at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215)
    	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:210)
    	at org.springframework.data.neo4j.aspects.config.Neo4jAspectConfiguration$$EnhancerByCGLIB$$8e72a26.typeRepresentationStrategyFactory(<generated>)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:601)
    	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:145)
    	... 57 more
    
    Jul 24, 2012 10:54:54 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Jul 24, 2012 10:54:54 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/alexa-web] startup failed due to previous errors
    Jul 24, 2012 10:54:54 AM org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    Jul 24, 2012 10:54:55 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
    Full log is here Attachment

    I tried switching Spring Data Neo4j versions, but with no success.
    Also when I run it as a standard Java application against same applicationContext.xml (not as a War into Tomcat container) everything correctly runs.


    My environment is:
    Linux (Ubuntu)
    Java 1.7.0_05
    Maven 3.0.4
    STS 2.9.2.RELEASE
    AspectJ 1.7
    Tomcat 7.0.27

    My applicationContext.xml is:

    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-3.0.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.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-2.5.xsd">
    
        <context:annotation-config/>
        <context:spring-configured/>
        <context:component-scan base-package="org.neo4j.cineasts">
            <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
        </context:component-scan>
    
        <neo4j:config storeDirectory="data/graph.db"/>
        <neo4j:repositories base-package="test.test" repository-impl-postfix="Impl"/>
        
        <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
    
        <!--import resource="applicationContext-security.xml"/-->
    </beans>
    Where could be the problem? Please help.
    Attached Files

  • #2
    Strangely enough, now plain Java app which I run outside of the Tomcat container also started to produce same exception.

    Will be grateful for any hint...

    Comment


    • #3
      Found similar issue: http://forum.springsource.org/showth...ase-getIndex()

      Tried switching to Spring Core versions 3.1.0.RELEASE, 3.1.1.RELEASE - same exception

      Comment


      • #4
        Hi,

        I found the reason in my particular case: the package whose name was put in context:component-scan in Spring's applicationContext.xml didn't exist.

        Mistakes do happen, but in my opinion NullPointerException is not very appropriate indication for such condition.

        Hopefully will save someone some hours/days
        Last edited by hsherlock; Jul 25th, 2012, 12:53 AM.

        Comment

        Working...
        X