echoview2
echoview2

Reputation: 21

com.fasterxml.jackson.core.JsonParseException(Invalid UTF-8 start byte) occured when using multibyte character

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.

Upvotes: 2

Views: 6682

Answers (1)

František Hartman
František Hartman

Reputation: 15086

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

Upvotes: 2

Related Questions