Neo4j“没有依赖满足类型类 org.neo4j.kernel.api.index.SchemaIndexProvider" [英] Neo4j "No dependency satisfies type class org.neo4j.kernel.api.index.SchemaIndexProvider"

查看:14
本文介绍了Neo4j“没有依赖满足类型类 org.neo4j.kernel.api.index.SchemaIndexProvider"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Neo4j 社区 2.3.3 Linux (Ubuntu 14.04)

Neo4j Community 2.3.3 Linux (Ubuntu 14.04)

尝试运行一个使用 Kafka 主题的 Java 应用,在查询 Neo4j 时处理其消息,并将它们写入另一个 Kafka 主题.

Trying to run a Java app which consumes a Kafka topic, process its messages while querying Neo4j, and writes them to another Kafka topic.

hduser@ubuntu:~$ java -jar gradle1-0.1.0.jar localhost:9092 musicgrp raw-events enriched-events bad-events /home/ubuntu/GeoLiteCity.dat
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, /home/hduser/neo4jdb2/data/graph.db
    at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:143)
    at org.neo4j.kernel.impl.factory.CommunityFacadeFactory.newFacade(CommunityFacadeFactory.java:43)
    at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:108)
    at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:129)
    at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:117)
    at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:185)
    at music.StreamApp.main(StreamApp.java:40)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.NeoStoreDataSource@1d606256' was successfully initialized, but failed to start. Please see attached cause exception.
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:462)
    at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
    at org.neo4j.kernel.impl.transaction.state.DataSourceManager.start(DataSourceManager.java:112)
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)
    at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
    at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:139)
    ... 6 more
Caused by: org.neo4j.kernel.impl.util.UnsatisfiedDependencyException: No dependency satisfies type class org.neo4j.kernel.api.index.SchemaIndexProvider
    at org.neo4j.kernel.impl.util.Dependencies.resolveDependency(Dependencies.java:78)
    at org.neo4j.kernel.impl.util.Dependencies.resolveDependency(Dependencies.java:74)
    at org.neo4j.kernel.NeoStoreDataSource.start(NeoStoreDataSource.java:507)
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)
    ... 11 more

这是我的 gradle.build,我读了一些关于将 Neo4j jars 排除在包之外的帖子......通过使用 --classpath 指向它的 jars ... 我是 Gradle 的新手,这是否相关?

This is my gradle.build, I read some post about keeping Neo4j jars out of the bundle ... by pointing to its jars with --classpath ... I'm new to Gradle, is this relevant ?

apply plugin: 'java'
apply plugin: 'application'
sourceCompatibility = '1.8' 
mainClassName = 'music.StreamApp'
repositories {
    mavenCentral()
}
version = '0.1.0'
dependencies { 
    compile 'org.apache.kafka:kafka-clients:0.9.0.0'
    compile 'com.maxmind.geoip:geoip-api:1.2.14'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.6.3'
    compile 'org.slf4j:slf4j-api:1.7.5'
    compile 'org.neo4j:neo4j:2.3.3'
}
jar { // c
manifest {
    attributes 'Main-Class': mainClassName
}
from {
    configurations.compile.collect {
        it.isDirectory() ? it : zipTree(it)
    }
} {
    exclude "META-INF/*.SF"
    exclude "META-INF/*.DSA"
    exclude "META-INF/*.RSA"
}
}

推荐答案

我怀疑你没有 META-INF/services/org.neo4j.kernel.extension.KernelExtensionFactory 文件在你的罐子里正确.Neo4j 在内部使用 JVM 的 ServiceLoader 来加载其组件.

My suspicion is that you don't have the META-INF/services/org.neo4j.kernel.extension.KernelExtensionFactory files in your jar correctly. Internally Neo4j uses JVM's ServiceLoader to load its components.

https://github.com/neo4j/neo4j/blob/2.3/community/lucene-index/src/main/resources/META-INF/services/org.neo4j.kernel.extension.KernelExtensionFactory 用于可能丢失的部分.

See https://github.com/neo4j/neo4j/blob/2.3/community/lucene-index/src/main/resources/META-INF/services/org.neo4j.kernel.extension.KernelExtensionFactory for the potentially missing piece.

我认为解决此问题的正确方法不是更改 Gradle 的默认 jar 任务,而是使用正确处理 META-INF 文件的插件.我使用 shadow 插件获得了一些不错的体验.

I assume the right way to solve this is not by changing Gradle's default jar task, instead use a plugin that handles META-INF files correctly. I've made some good experiences with the shadow plugin.

这篇关于Neo4j“没有依赖满足类型类 org.neo4j.kernel.api.index.SchemaIndexProvider"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆