Getting connection errors to in-memory neo4j instance during testing using the new spring-data-neo4j 6.0.0-SNAPSHOT

huangapple go评论74阅读模式
英文:

Getting connection errors to in-memory neo4j instance during testing using the new spring-data-neo4j 6.0.0-SNAPSHOT

问题

使用发布版本,此应用程序代码正常工作。然而,切换到更新的快照版本后,我现在遇到异常。

异常消息让我认为需要更改配置以使我的测试用例再次工作,但是我无论如何都无法弄清楚它们需要什么。

任何帮助将不胜感激。

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>2.4.0-SNAPSHOT</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-neo4j</artifactId>
            <version>6.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
</dependencyManagement>

我的测试用例使用了注解:

  • @SpringBootTest
  • @EnableAutoConfiguration
  • @AutoConfigureDataNeo4j
Caused by: org.springframework.dao.PermissionDeniedDataAccessException: 不支持的身份验证令牌,仅当禁用身份验证时才允许使用方案 &#39;none&#39;; 错误代码 &#39;Neo.ClientError.Security.Unauthorized&#39;
    at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateImpl(Neo4jPersistenceExceptionTranslator.java:105) ~[spring-data-neo4j-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
    ...

在一些测试变体中,我得到:
“请注意,Neo4j 4.0 中默认的加密设置已更改”。

英文:

Using the release versions, this application code works. However, switching to the newer snapshots, I am now getting exceptions.

The exception messages lead me to think a config change is needed to get my test cases working again, but for the life of me I cannot figure out what they would need to be.

Any help would be appreciated.

&lt;dependencyManagement&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
            &lt;artifactId&gt;spring-boot-dependencies&lt;/artifactId&gt;
            &lt;version&gt;2.4.0-SNAPSHOT&lt;/version&gt;
            &lt;type&gt;pom&lt;/type&gt;
            &lt;scope&gt;import&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
            &lt;artifactId&gt;spring-data-neo4j&lt;/artifactId&gt;
            &lt;version&gt;6.0.0-SNAPSHOT&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/dependencyManagement&gt;

My test case is using annotations:

  • @SpringBootTest
  • @EnableAutoConfiguration
  • @AutoConfigureDataNeo4j
Caused by: org.springframework.dao.PermissionDeniedDataAccessException: Unsupported authentication token, scheme &#39;none&#39; is only allowed when auth is disabled.; Error code &#39;Neo.ClientError.Security.Unauthorized&#39;
	at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateImpl(Neo4jPersistenceExceptionTranslator.java:105) ~[spring-data-neo4j-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateExceptionIfPossible(Neo4jPersistenceExceptionTranslator.java:83) ~[spring-data-neo4j-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.data.neo4j.core.DefaultNeo4jClient.potentiallyConvertRuntimeException(DefaultNeo4jClient.java:187) ~[spring-data-neo4j-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.data.neo4j.core.DefaultNeo4jClient.access$400(DefaultNeo4jClient.java:59) ~[spring-data-neo4j-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.one(DefaultNeo4jClient.java:298) ~[spring-data-neo4j-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.data.neo4j.core.Neo4jTemplate$DefaultExecutableQuery.getSingleResult(Neo4jTemplate.java:525) ~[spring-data-neo4j-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.data.neo4j.repository.query.Neo4jQueryExecution$DefaultQueryExecution.execute(Neo4jQueryExecution.java:53) ~[spring-data-neo4j-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.data.neo4j.repository.query.AbstractNeo4jQuery.execute(AbstractNeo4jQuery.java:68) ~[spring-data-neo4j-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:135) ~[spring-data-commons-2.4.0-M2.jar:2.4.0-M2]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:119) ~[spring-data-commons-2.4.0-M2.jar:2.4.0-M2]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:151) ~[spring-data-commons-2.4.0-M2.jar:2.4.0-M2]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:130) ~[spring-data-commons-2.4.0-M2.jar:2.4.0-M2]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80) ~[spring-data-commons-2.4.0-M2.jar:2.4.0-M2]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:367) ~[spring-tx-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118) ~[spring-tx-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) ~[spring-tx-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.3.0-M2.jar:5.3.0-M2]
	at com.sun.proxy.$Proxy133.findByName(Unknown Source) ~[na:na]
	at ...
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1847) ~[spring-beans-5.3.0-M2.jar:5.3.0-M2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1784) ~[spring-beans-5.3.0-M2.jar:5.3.0-M2]
	... 81 common frames omitted

In some variations of my testing, I get:
"Note that the default encryption setting has changed in Neo4j 4.0"

答案1

得分: 1

以下是翻译好的内容:

你的应用程序属性是什么?

SDN6的语法已更改,但可能尚未更新到文档中。

参见:

https://github.com/michael-simons/neo4j-sdn-ogm-tips/blob/master/examples/sdn6/src/main/resources/application.properties

嗯,实际上在自述文件中有(但尚未在文档中更新):

https://github.com/spring-projects/spring-data-neo4j

还有在引导文档中:

https://docs.spring.io/spring-boot/docs/2.4.0-SNAPSHOT/reference/htmlsingle/#boot-features-connecting-to-neo4j

英文:

What are your application properties?

The syntax changed for SDN6, but might not have made it into the docs

See:

https://github.com/michael-simons/neo4j-sdn-ogm-tips/blob/master/examples/sdn6/src/main/resources/application.properties

ah it actually has it in the readme (but not yet in the docs):

https://github.com/spring-projects/spring-data-neo4j

Also in the boot docs:

https://docs.spring.io/spring-boot/docs/2.4.0-SNAPSHOT/reference/htmlsingle/#boot-features-connecting-to-neo4j

huangapple
  • 本文由 发表于 2020年9月2日 12:08:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/63698575.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定