Spring boot Spring Data Neo4j:无法在配置的最长时间内从池中获取连接
我正在对我的Neo4j客户端进行压力测试,该客户端是使用spring-boot-starter-data-Neo4j构建的 经过一段时间后,应用程序抛出错误无法获取任何请求的连接 这是我的Neo4j连接的bean配置。有人能检查并告诉我们可以做什么吗Spring boot Spring Data Neo4j:无法在配置的最长时间内从池中获取连接,spring-boot,neo4j,spring-data-neo4j,Spring Boot,Neo4j,Spring Data Neo4j,我正在对我的Neo4j客户端进行压力测试,该客户端是使用spring-boot-starter-data-Neo4j构建的 经过一段时间后,应用程序抛出错误无法获取任何请求的连接 这是我的Neo4j连接的bean配置。有人能检查并告诉我们可以做什么吗 id("org.springframework.boot") version "2.4.0" @Configuration @EnableTransactionManagement cl
id("org.springframework.boot") version "2.4.0"
@Configuration
@EnableTransactionManagement
class Neo4jConfig(
@Value("\${spring.neo4j.uri}")
val neo4jDBUri: String,
@Value("\${spring.neo4j.authentication.username}")
val neo4jDbUserName: String,
@Value("\${spring.neo4j.authentication.password}")
val neo4jDbUserPassword: String
) : AbstractNeo4jConfig() {
// https://medium.com/neo4j/try-and-then-retry-there-can-be-failure-30bf336383da
@Bean
override fun driver(): Driver {
val config: Config = Config.builder()
.withMaxTransactionRetryTime(60, TimeUnit.SECONDS)
.withLeakedSessionsLogging()
.withRoutingTablePurgeDelay(1, TimeUnit.SECONDS)
.withConnectionAcquisitionTimeout(2 * 60, TimeUnit.SECONDS)
.withConnectionLivenessCheckTimeout(2 * 60, TimeUnit.SECONDS)
.withDriverMetrics()
.withMaxConnectionPoolSize(100)
.build()
return GraphDatabase
.driver(neo4jDBUri, AuthTokens.basic(neo4jDbUserName, neo4jDbUserPassword), config)
}
}
// Refer: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4.0-M2-Release-Notes#neo4j-1
@Bean(ReactiveNeo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)
fun reactiveTransactionManager(
driver: Driver,
databaseNameProvider: ReactiveDatabaseSelectionProvider
): ReactiveTransactionManager = ReactiveNeo4jTransactionManager(driver, databaseNameProvider)
// Refer: https://hantsy.medium.com/data-auditing-with-spring-data-neo4j-11d6461146ff
@Configuration(proxyBeanMethods = false)
@EnableReactiveNeo4jAuditing
internal class DataConfig {
@Bean
fun reactiveAuditorAware(): ReactiveAuditorAware<String> = ReactiveAuditorAware { Mono.just("Audit enabled") }
}
我看不到您的配置,但返回HTTP 400错误请求的
使我怀疑您是否连接到HTTP服务器(默认7474)或其他任何东西,而不是螺栓端口(默认7687)。我看不到您的配置,但返回HTTP 400错误请求的使我怀疑您是否连接到HTTP服务器(默认值7474)或任何其他代替螺栓端口(默认值7687)的内容
webFilters.ControllerConfig in Neo4jDriverIO-2-2 - Returning HTTP 400 Bad Requestorg.springframework.dao.InvalidDataAccessResourceUsageException: Unable to acquire connection from the pool within configured maximum time of 120000ms; Error code 'N/A' at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateImpl(Neo4jPersistenceExceptionTranslator.java:105) Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Error has been observed at the following site(s): |_ checkpoint ⇢ Handler
controller.UserApiController#createUser(UserReqModel, Continuation) [DispatcherHandler]Stack trace: at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateImpl(Neo4jPersistenceExceptionTranslator.java:105) at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateExceptionIfPossible(Neo4jPersistenceExceptionTranslator.java:91) at org.springframework.data.neo4j.core.DefaultReactiveNeo4jClient.potentiallyConvertRuntimeException(DefaultReactiveNeo4jClient.java:271) at org.springframework.data.neo4j.core.DefaultReactiveNeo4jClient.access$200(DefaultReactiveNeo4jClient.java:54) at org.springframework.data.neo4j.core.DefaultReactiveNeo4jClient$DefaultRecordFetchSpec.la