2

I'm trying to configure my application context in order to be able to use the Neo4j server with an embedded graph in my app without much success. I'm using Spring Data at the same time (both Mongo and Neo4j repositories approach). This is my application-context, which isn't running:

<context:component-scan base-package="org.domain.team.project.*"/>

<mongo:repositories base-package="org.domain.team.project.data.repositories.mongodb"/>

    <!-- Neo4j -->
    <!--  <neo4j:config storeDirectory="/data/production/graph.db"/> -->
    <neo4j:repositories base-package="org.domain.team.project.data.repositories.neo4j"/>

    <neo4j:config graphDatabaseService="graphDatabaseService" />
    <bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase"
    destroy-method="shutdown">
        <constructor-arg index="0" value="/data/production/graph.db" />
        <constructor-arg index="1">
            <map><entry key="enable_remote_shell" value="true"/></map>
        </constructor-arg>
    </bean>
    <bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" 
        init-method="start" destroy-method="stop">
            <constructor-arg ref="graphDatabaseService"/>
    </bean>

If I don't use this approach and specify simply the store directory (commented line) everything runs fine. I suspect it's a version between SDN and neo4j-server issue. This is my POM:

  <properties>
    <spring.data.mongo.version>1.1.0.RELEASE</spring.data.mongo.version>
    <spring.data.neo4j.version>2.1.0.RELEASE</spring.data.neo4j.version>
  </properties>

  <dependencies>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-mongodb</artifactId>
        <version>${spring.data.mongo.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-neo4j</artifactId>
        <version>${spring.data.neo4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.neo4j.app</groupId>
        <artifactId>neo4j-server</artifactId>
        <version>1.8.2</version>
    </dependency>
    <dependency>
        <groupId>org.neo4j.app</groupId>
        <artifactId>neo4j-server</artifactId>
        <classifier>static-web</classifier>
        <version>1.8.2</version>
    </dependency>
  </dependencies>

Its parent has as a dependency Spring(core,context,test) 3.2.0 Release.

The concrete error being displayed is:

Caused by: java.lang.NoSuchFieldError: query_cache_size
    at org.neo4j.cypher.ExecutionEngine.org$neo4j$cypher$ExecutionEngine$$getQueryCacheSize(ExecutionEngine.scala:95)
    at org.neo4j.cypher.ExecutionEngine$$anon$1.<init>(ExecutionEngine.scala:91)
    at org.neo4j.cypher.ExecutionEngine.<init>(ExecutionEngine.scala:91)
    at org.neo4j.cypher.javacompat.ExecutionEngine.<init>(ExecutionEngine.java:54)
    at org.neo4j.cypher.javacompat.ExecutionEngine.<init>(ExecutionEngine.java:44)
    at org.springframework.data.neo4j.support.query.CypherQueryEngine.<init>(CypherQueryEngine.java:42)
    at org.springframework.data.neo4j.support.DelegatingGraphDatabase.createCypherQueryEngine(DelegatingGraphDatabase.java:217)
    at org.springframework.data.neo4j.support.DelegatingGraphDatabase.queryEngineFor(DelegatingGraphDatabase.java:190)
    at org.springframework.data.neo4j.support.MappingInfrastructureFactoryBean.afterPropertiesSet(MappingInfrastructureFactoryBean.java:146)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
    ... 47 more

which as far as I am concerned, should be no problem as the default value is 100. The SDN doc does not talk too much about it. Any suggestions?

Thank you all in advance.

jarandaf
  • 4,297
  • 6
  • 38
  • 67

1 Answers1

4

Looks like version compatibility issue. For me below combination is working fine

spring-data-neo4j : 2.1.0.RC4
spring-data-mongodb : 1.1.0.RELEASE 
neo4j-server : 1.8
static-web : 1.8

Further, I am using-

Spring framework version : 3.1.2.RELEASE
Neo4j version : 1.8
mongodb version : 2.2.2
mongo-java-driver : 2.9.1
slf4j : 1.7.2
Gopi
  • 10,073
  • 4
  • 31
  • 45
  • 1
    Downgrading to neo4j-server 1.8 version and solving some multiple SL4J bindings issues solved the problem, thanks! – jarandaf Apr 09 '13 at 15:55
  • By the way, the interface is ready under http://localhost:7474 but not under http://:7474. Any clues? It's a Neo4j box in the same private network which I would like being able to access. – jarandaf Apr 09 '13 at 18:25
  • Ok, solved it by implementing this class http://components.neo4j.org/neo4j-server/1.8/apidocs/org/neo4j/server/configuration/Configurator.html and passing it as second parameter to the server wrapper. More details here: http://www.cakesolutions.net/teamblogs/2012/05/23/enabling-neo4j-web-admin-tool-on-the-embedded-server-using-spring-data/ – jarandaf Apr 09 '13 at 20:45
  • Why trying to package everything into a JAR gives issues? Running it from Eclipse works like a charm but running it from the JAR seems not to be working: the interface is visible but the complete functionality is lost. The server is giving all the time 500 error. This problem has been detected but no clear solution was provided: https://groups.google.com/forum/#!topic/neo4j/rjyf09pYIaM – jarandaf Apr 10 '13 at 14:43
  • Interesting, but the post you are referring to seems to be talking about server plugin development. Are you developing a neo4j server plugin? – Gopi Apr 10 '13 at 16:46
  • No, but I actually want to package everything into a JAR: the problem is the same (what you say is the origin of the post, the jar issue was found afterwards) – jarandaf Apr 10 '13 at 17:14
  • With all above mentioned packages in my answer, I am packaging everything into one war and deploying as web application in web server, everything is working very smoothly. – Gopi Apr 10 '13 at 17:18