首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >HA模式下的Neo4j嵌入式服务器

HA模式下的Neo4j嵌入式服务器
EN

Stack Overflow用户
提问于 2014-10-20 13:38:59
回答 2查看 217关注 0票数 0

我正在尝试在HA模式下使用neo4j嵌入式服务器和spring数据ne4j.我收到类加载错误。我已经把所有的罐子都放好了。我正在尝试在HA模式下使用neo4j嵌入式服务器和spring数据ne4j.我收到类加载错误。我已经把所有的罐子都放好了。

代码语言:javascript
复制
    Running Grails application
        | Error 2014-10-18 17:27:46,878 [localhost-startStop-1] ERROR spring.GrailsRuntimeConfigurator - [RuntimeConfiguration] Unable to perform post initialization config: file:./grails-app/conf/spring/resources.xml
        Message: org.neo4j.kernel.HighlyAvailableGraphDatabase
        Line | Method
        ->> 366 | run in java.net.URLClassLoader$1

        | 355 | run in ''
        | 354 | findClass in java.net.URLClassLoader
        | 425 | loadClass in java.lang.ClassLoader
        | 262 | run . . . in java.util.concurrent.FutureTask
        | 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
        | 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker

    and my xml configuration is

        <?xml version="1.0" encoding="UTF-8"?>
        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"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/data/neo4j
        http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd">

        <context:component-scan base-package="neo4j"></context:component-scan>
        <bean id="haDatabase" class="org.neo4j.kernel.HighlyAvailableGraphDatabase"
            destroy-method="shutdown">
            <constructor-arg index="0" value="target/db" />
            <constructor-arg index="1">
                <map>
                    <entry key="ha.server_id" value="1" />
                    <entry key="ha.server" value="localhost:6001" />
                    <entry key="ha.coordinators" value="localhost:2181,localhost:2182,localhost:2183" />
                </map>
            </constructor-arg>
        </bean>
        <neo4j:config graphDatabaseService="haDatabase"  base-package="neo4j"/>
        <bean id="config"
            class="org.springframework.data.neo4j.config.DataGraphNamespaceHandlerTests$Config" />
         <neo4j:repositories base-package="neo4jRepository" />

and i have dependencies are
compile "org.springframework.data:spring-data-neo4j:3.2.0.RELEASE"
compile "org.neo4j:neo4j-enterprise:2.1.5"
compile "org.neo4j:neo4j-ha:2.1.5"
compile "org.neo4j:neo4j-cluster:jar:2.0.0"
EN

回答 2

Stack Overflow用户

发布于 2014-10-21 03:22:41

由于API在Neo4j 1.9中的更改,您不能直接实例化HighlyAvailableGraphDatabase。相反,您应该使用HighlyAvailableGraphdatabaseFactory。请看我的一篇讲解如何使用它的文章:https://gist.github.com/sarmbruster/6222698

票数 2
EN

Stack Overflow用户

发布于 2015-02-17 05:23:04

此示例还可能对您使用java代码有所帮助。(Neo4j 2.1.2)

https://github.com/Jotschi/neo4j-ha-example

代码片段:

代码语言:javascript
复制
    GraphDatabaseBuilder builder = new HighlyAvailableGraphDatabaseFactory().newHighlyAvailableDatabaseBuilder(DB_LOCATION);

    builder.setConfig(ClusterSettings.server_id, SERVER_ID);
    builder.setConfig(HaSettings.ha_server, "localhost:6001");
    builder.setConfig(HaSettings.slave_only, Settings.FALSE);
    builder.setConfig(ClusterSettings.cluster_server, "localhost:5001");
    builder.setConfig(ClusterSettings.initial_hosts, "localhost:5001,localhost:5002");

    graphDb = builder.newGraphDatabase();
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26459145

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档