Spring Neo4j测试JsonParseException:无效的UTF-8中间字节0xe5

时间:2016-07-13 08:53:02

标签: maven neo4j spring-boot spring-data-neo4j spring-data-neo4j-4

在我的Spring Boot / Neo4j / Spring Data Neo4j 4.2.0应用程序中,我使用传统的全文搜索和非拉丁字符运行测试。

从Eclipse IDE开始,一切正常,但是使用以下Maven命令从控制台构建:

mvn clean install 

我收到以下异常:

2016-07-13 11:43:19 [main] WARN  o.s.test.context.TestContextManager -
                                Caught exception while allowing TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener@1a2499c] to process 'after' execution for test: method [public void com.example.domain.service.search.SearchServ
iceTest.testForeignLanguage()], instance [com.example.domain.service.search.SearchServiceTest@cbd50c], exception [java.lang.RuntimeExceptio
n: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0xe5
 at [Source: [B@f81110; line: 1, column: 68]]
java.lang.NullPointerException: null
        at org.springframework.data.neo4j.transaction.Neo4jTransactionManager.doRollback(Neo4jTransactionManager.java:188)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.jav
a:853)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:830)
        at org.springframework.test.context.transaction.TransactionContext.endTransaction(TransactionContext.java:125)
        at org.springframework.test.context.transaction.TransactionalTestExecutionListener.afterTestMethod(TransactionalTestExecutionListene
r.java:227)
        at org.springframework.test.context.TestContextManager.afterTestMethod(TestContextManager.java:319)
        at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:94)
        at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
        at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:344)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:269)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:240)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:184)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:286)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:240)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)

有什么不对?

已更新

我已将以下属性和插件添加到我的pom.xml

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>${java.source.version}</source>
                <target>${java.target.version}</target>
                <encoding>${project.build.sourceEncoding}</encoding>
                <optimize>true</optimize>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <encoding>${project.build.sourceEncoding}</encoding>
            </configuration>
        </plugin>
    </plugins>
</build>

但它没有帮助。

0 个答案:

没有答案