0

Trying to setup Neo4J with a remote REST graph database configuration. I have gotten a local, embedded setup to work fine. The only change is how the GraphDatabaseService is configured.

I'm using Spring Data Neo4J 3.2.1 and Neo4J 2.1.4.

Ideas?

Config:

package com.toyfiles.configuration;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.rest.graphdb.RestGraphDatabase;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.neo4j.config.EnableNeo4jRepositories;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@Profile("RestDBServer")
@EnableTransactionManagement
@EnableNeo4jRepositories(basePackages = "com.toyfiles.dataservices")
public class RestDBConfig extends Neo4jConfiguration {

    public RestDBConfig() {
        setBasePackage("com.toyfiles");
    }

    @Bean
    public GraphDatabaseService graphDatabaseService() {
        return new RestGraphDatabase("http://localhost:7474/db/data");
    }
}

Here's the exception

 Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.data.neo4j.core.GraphDatabase org.springframework.data.neo4j.config.Neo4jConfiguration.graphDatabase()] threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:188)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:586)
... 136 more
Caused by: java.lang.NullPointerException
at org.neo4j.cypher.ExecutionEngine.createCompiler(ExecutionEngine.scala:149)
at org.neo4j.cypher.ExecutionEngine.<init>(ExecutionEngine.scala:48)
at org.neo4j.cypher.javacompat.ExecutionEngine.createInnerEngine(ExecutionEngine.java:59)
at org.neo4j.cypher.javacompat.ExecutionEngine.<init>(ExecutionEngine.java:43)
at org.springframework.data.neo4j.support.query.CypherQueryEngineImpl.<init>(CypherQueryEngineImpl.java:41)
at org.springframework.data.neo4j.support.DelegatingGraphDatabase.createCypherQueryEngine(DelegatingGraphDatabase.java:219)
at org.springframework.data.neo4j.support.DelegatingGraphDatabase.queryEngine(DelegatingGraphDatabase.java:208)
at org.springframework.data.neo4j.support.DelegatingGraphDatabase.queryEngine(DelegatingGraphDatabase.java:215)
at org.springframework.data.neo4j.support.DelegatingGraphDatabase.queryEngine(DelegatingGraphDatabase.java:201)
at org.springframework.data.neo4j.support.schema.SchemaIndexProvider.<init>(SchemaIndexProvider.java:36)
at org.springframework.data.neo4j.support.DelegatingGraphDatabase.<init>(DelegatingGraphDatabase.java:72)
at org.springframework.data.neo4j.support.DelegatingGraphDatabase.<init>(DelegatingGraphDatabase.java:67)
at org.springframework.data.neo4j.config.Neo4jConfiguration.graphDatabase(Neo4jConfiguration.java:259)
at com.toyfiles.configuration.RestDBConfig$$EnhancerBySpringCGLIB$$1110ba63.CGLIB$graphDatabase$27(<generated>)
at com.toyfiles.configuration.RestDBConfig$$EnhancerBySpringCGLIB$$1110ba63$$FastClassBySpringCGLIB$$679e9620.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
at com.toyfiles.configuration.RestDBConfig$$EnhancerBySpringCGLIB$$1110ba63.graphDatabase(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:166)
... 137 more

1 Answer 1

2

Sometimes posting sparks an idea.

I needed to use SpringRestGraphDatabase, not just RestGraphDatabase.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.