gpt4 book ai didi

scala - 不支持的身份验证 token ,方案 ='none' 仅在禁用身份验证时才允许 : { scheme ='none' } - Neo4j Authentication Error

转载 作者:行者123 更新时间:2023-12-03 14:43:03 29 4
gpt4 key购买 nike

我正在尝试使用 neo4j-spark-connector 从 Spark 连接到 Neo4j。我在尝试连接到 Neo4j 时遇到身份验证问题 org.neo4j.driver.v1.exceptions.AuthenticationException: Unsupported authentication token, scheme='none' only allowed when auth is disabled: { scheme='none' }
我已经检查过并且我传递的凭据是正确的。不知道为什么会失败。

import org.neo4j.spark._
import org.apache.spark._
import org.graphframes._
import org.apache.spark.sql.SparkSession
import org.neo4j.driver.v1.GraphDatabase
import org.neo4j.driver.v1.AuthTokens

val config = new SparkConf()

config.set(Neo4jConfig.prefix + "url", "bolt://localhost")
config.set(Neo4jConfig.prefix + "user", "neo4j")
config.set(Neo4jConfig.prefix + "password", "root")

val sparkSession :SparkSession = SparkSession.builder.config(config).getOrCreate()

val neo = Neo4j(sparkSession.sparkContext)

val graphFrame = neo.pattern(("Person","id"),("KNOWS","null"), ("Employee","id")).partitions(3).rows(1000).loadGraphFrame


println("**********Graphframe Vertices Count************")
graphFrame.vertices.count

println("**********Graphframe Edges Count************")
graphFrame.edges.count


val pageRankFrame = graphFrame.pageRank.maxIter(5).run()
val ranked = pageRankFrame.vertices
ranked.printSchema()

val top3 = ranked.orderBy(ranked.col("pagerank").desc).take(3)

有人可以看看,让我知道同样的原因吗?

最佳答案

我有一个类似的问题,创建以下 spring bean 解决了这个问题。

    @Bean
public org.neo4j.ogm.config.Configuration getConfiguration() {
return new org.neo4j.ogm.config.Configuration.Builder()
.credentials("neo4j", "secret")
.uri("bolt://localhost:7687").build();
}

@Bean
public SessionFactory sessionFactory(org.neo4j.ogm.config.Configuration configuration) {
return new SessionFactory(configuration,
"<your base package>");
}

关于scala - 不支持的身份验证 token ,方案 ='none' 仅在禁用身份验证时才允许 : { scheme ='none' } - Neo4j Authentication Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58377865/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com