1

In my Spring Boot/Neo4j/Spring Data Neo4j 4.2.0 application I'm running a test with a legacy fulltext search and non-Latin characters.

From Eclipse IDE everything working fine but from console build with a following Maven command:

mvn clean install 

I'm getting a following exception:

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)

What can be wrong ?

UPDATED

I have added following properties and plugins into my 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>

but it doesn't help.

alexanoid
  • 24,051
  • 54
  • 210
  • 410
  • 1
    It's probably an encoding issue, if you haven't set it in your `pom.xml`. However, you should try to obtain the stack trace of the `JsonParseException` as it's the real issue, hidden by the `NullPointerException` in the rollback of the `TransactionalTestExecutionListener`. E.g. you could run the test in debug mode and break on the creation of the exception. – Frank Pavageau Jul 13 '16 at 11:31
  • I have updated my question with pom.xml config – alexanoid Jul 13 '16 at 11:40
  • and I can't produce this issue in my Eclipse IDE and hence cannot debug.. it is only producible from Maven console run – alexanoid Jul 13 '16 at 11:54
  • 1
    Sure you can: [debugging Maven tests](https://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html). Run your tests with a Maven console run, attach the debugger. – Frank Pavageau Jul 13 '16 at 12:13
  • Thanks for the good point ! I have added -Dfile.encoding=UTF-8 to maven-surefire-plugin and now everything works fine. – alexanoid Jul 13 '16 at 13:26
  • Possible duplicate of [jackson JsonParseException: Invalid UTF-8 middle byte](https://stackoverflow.com/questions/6352861/jackson-jsonparseexception-invalid-utf-8-middle-byte) – Raedwald Aug 23 '18 at 08:11

0 Answers0