只有来自 GraphRepository<> 的 findAll() 在 org.neo4j.graphdb.TransactionFailureException 中结束:无法将事务标记为仅回滚

only findAll() from GraphRepository<> ends in org.neo4j.graphdb.TransactionFailureException: Failed to mark transaction as rollback only

通过使用 GraphRepository<Account> 中的 findAll()

    context = new ClassPathXmlApplicationContext("spring/spring-config.xml");
    accountService = (AccountService) context.getBean("accountService");

    //getAll(){return accountRepository.findAll()}

    accountService.getAll().forEach(account -> System.out.println(account));

(顺便说一下,我的 accountService 的所有其他功能都有效)

我收到此错误:

 Exception in thread "main" org.neo4j.graphdb.TransactionFailureException: 
 Failed to mark transaction as rollback only.

我尝试通过以下方式解决问题:Spring Data Neo4J repository findAll() results in a nullpointerexception, 所以我在 spring-config.xml 中添加 <tx:annotation-driven mode="proxy"/> 但这并不能解决我的问题。

这里是我的 github 回购:https://github.com/mzober/springContextWorld/tree/CollectorManager_ErrorBranch

这是我的 spring-config.xml:

 <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
   xmlns:tx="http://www.springframework.org/schema/tx"
   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
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx.xsd">
<context:annotation-config/>
<context:spring-configured/>

<context:component-scan base-package="com.mz.springContextWorld.domain"/>
<context:component-scan base-package="com.mz.springContextWorld.repositories"/>
<context:component-scan base-package="com.mz.springContextWorld.gui.listener"/>
<context:component-scan base-package="com.mz.springContextWorld.gui.components"/>
<context:component-scan base-package="com.mz.springContextWorld.gui.creational"/>
<context:component-scan base-package="com.mz.springContextWorld.services"/>

<neo4j:config storeDirectory="target/neo4j-db-plain"
              base-package="com.mz.springContextWorld.domain"/>
<neo4j:repositories base-package="com.mz.springContextWorld.repositories"/>

<tx:annotation-driven mode="proxy"/>

如果我需要 post 更多代码请写评论。

感谢您的帮助。

这可能与以下问题有关:https://jira.spring.io/browse/DATAGRAPH-531。如果是这样,你需要改变

service.findAll()

至:

service.findAll().as(Collection.class)

...回滚异常应该消失。