2
votes

I tried to save a node entity(@NodeEntity) whose property(string type) has multi-byte string like Japanese, but JsonParseException occurred.

java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 start byte 0x8d at [Source: [B@569cfc36; line: 1, column: 67]
    at org.neo4j.ogm.drivers.bolt.request.BoltRequest.executeRequest(BoltRequest.java:175) ~[neo4j-ogm-bolt-driver-2.1.2.jar!/:na]
    at org.neo4j.ogm.drivers.bolt.request.BoltRequest.execute(BoltRequest.java:89) ~[neo4j-ogm-bolt-driver-2.1.2.jar!/:na]
    at org.neo4j.ogm.session.request.RequestExecutor.executeSave(RequestExecutor.java:287) ~[neo4j-ogm-core-2.1.1.jar!/:na]
    at org.neo4j.ogm.session.request.RequestExecutor.executeSave(RequestExecutor.java:66) ~[neo4j-ogm-core-2.1.1.jar!/:na]
    at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:85) ~[neo4j-ogm-core-2.1.1.jar!/:na]
    at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:44) ~[neo4j-ogm-core-2.1.1.jar!/:na]
    at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:447) ~[neo4j-ogm-core-2.1.1.jar!/:na]

But if I invoked java with -Dfile.encoding=UTF-8 option, a entity is saved correctly...

Please advice me how to save multi-byte string without -D=file.encoding option? I think that it is preferred that encoding is specified in config file or by coding.

Thanks.

My Environment is here.

  • OS=Windows 7 64bit(Japanese Edition)
  • Java=JDK1.8u121
  • Spring Boot=1.5.2
  • Spring Boot Neo4j=4.2.1
  • Noe4j Driver= Bolt Driver 2.1.2
1

1 Answers

2
votes

This is a known issue in ogm - https://github.com/neo4j/neo4j-ogm/issues/244.

Current suggested workaround is exactly what you did - provide property at startup

-Dfile.encoding=UTF-8