How can I use the webadmin interface with an integrated Neo4j 2.0 instance?

advertisements

I have a project which has been running with an embedded Neo4j 1.8.2 plus web admin interface.

Now I updated the project to run with the latest Neo4j 2.0.1. Although there were some obstacles during that course (as I'm utilizing Spring Data Neo4j) in the end everything went smooth.

But currently I'm stuck in getting the web admin running with it.

Any advise would be highly appreciated.

Here's my config which I was using for the 1.8 version

(class for configuration referenced in the snippets)

package com.example;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.MapConfiguration;
import org.neo4j.server.configuration.Configurator;
import org.neo4j.server.configuration.ThirdPartyJaxRsPackage;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class Neo4jServerConfig implements Configurator {

    private Configuration config;

    public Neo4jServerConfig(Map<String, String> config) {
        this.config = new MapConfiguration(config);
    }

    @Override
    public Configuration configuration() {
        return config;
    }

    @Override
    public Map<String, String> getDatabaseTuningProperties() {
        return null;
    }

    @Override
    public Set<ThirdPartyJaxRsPackage> getThirdpartyJaxRsClasses() {
        return new HashSet<>();
    }

    @Override
    public Set<ThirdPartyJaxRsPackage> getThirdpartyJaxRsPackages() {
        return new HashSet<>();
    }

}

And the bean definitions ... ... ... ...

As mentioned ... this works as expected for the 1.8 embedded Neo4j.

But initialization under Neo4j 2.0 changed quite a bit. So I was forced to use the following bean definitions to get things running again

        <!-- neo4j server configuration -->
    <util:map id="neo4jConfig">
        <entry key="allow_store_upgrade" value="true"/>
        <entry key="enable_remote_shell" value="true"/>
        <entry key="online_backup_enabled" value="true"/>
        <entry key="node_auto_indexing" value="true"/>
        <entry key="node_keys_indexable" value="id,name,type,__type__"/>
        <entry key="relationship_auto_indexing" value="true"/>
    </util:map>

    <bean id="graphDbFactory" class="org.neo4j.graphdb.factory.GraphDatabaseFactory"/>

    <bean id="graphDbBuilder" factory-bean="graphDbFactory" factory-method="newEmbeddedDatabaseBuilder">
        <constructor-arg index="0" value="${neo4j.db.path}"/>
    </bean>

    <bean id="graphDbBuilderFinal" factory-bean="graphDbBuilder" factory-method="setConfig">
        <constructor-arg ref="neo4jConfig"/>
    </bean>

    <bean id="graphDatabaseService" factory-bean="graphDbBuilderFinal" factory-method="newGraphDatabase" destroy-method="shutdown" />

After that I get error markers in this bean definition

    <bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start" destroy-method="stop">
        <constructor-arg index="0" ref="graphDatabaseService" />
        <constructor-arg index="1" ref="config"/>
    </bean>

First, the "org.neo4j.server.WrappingNeoServerBootstrapper" is now deprecated - are there any alternatives, I can use?

And secondly it complains about wrong constructor-arg "graphDatabaseService" ... it says "bean must be of org.neo4j.kernel.GraphDatabaseAPI" (which is also deprecated)

The server starts (at least what I can see from my jetty logs) without errors, but trying to browse to localhost:28473 ends up with no response.

Any clue?

Thanks in advance.


Took me longer than I care to admit to get this working. Please take a look at this pom for the dependencies, basically 2 includes for neo4j-server and 2 for Jersey. You also have to config the WrappingNeoServerBootstrapper (deprecated).

My POM excludes the CH.QOS logging stuff from Neo4J in favour of my own log configuration.

I've used Spring as well and have externalised most of the config. You can see that file here.

Once that little lot is done, simply access localhost on port 7474.

<util:map id="config">
    <entry key="remote_shell_enabled" value="true"/>
</util:map>

<bean id="graphDbFactory" class="org.neo4j.graphdb.factory.GraphDatabaseFactory"/>

<bean id="graphDbBuilder" factory-bean="graphDbFactory" factory-method="newEmbeddedDatabaseBuilder">
    <constructor-arg value="${neo4j.datastore}"/>
</bean>

<bean id="graphDbBuilderFinal" factory-bean="graphDbBuilder" factory-method="setConfig">
    <constructor-arg ref="config"/>
</bean>

<bean id="graphDatabaseService" factory-bean="graphDbBuilderFinal" factory-method="newGraphDatabase"
      destroy-method="shutdown"/>

<bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start"
      destroy-method="stop">
    <constructor-arg ref="graphDatabaseService"/>
</bean>