Open mandarsgujar opened 5 years ago
I'm not sure it's an issue related to Achilles. Try to:
If the same error occurs, it means that it's a JSON encoding issue, not related to Achilles
@doanduyhai I am using Java Map in the model class annotated with @Table while fetching the data from DB. So, your first suggestion is already followed. My actual Map type column: @Column private Map <String, @json Address>;
& Query: UserEntity userEntity = userEntityManager.dsl().select().allColumns_FromBaseTable().where().userId().Eq(userId).getOne();
The seconds suggestion is already implemented in Achilles code 'info.archinnov.achilles.internals.codec.JSONCodec
Did you try this mapping:
@column
private Map <String, Address>;
Did Achilles successfully decode the Address
UDT ?
Yes, I've used this too, it works. But the tables having such UDT are read rarely so I didn't face such issue there. This issue only happens when there are Cassandra Connection issues - either required no. of replicas are not available or there is network connection problem from the application node to Cassandra.
In the absence of such Cassandra problems, this works without any issues. I wanted to see if there is any other issues.
Thanks @doanduyhai
"This issue only happens when there are Cassandra Connection issues - either required no. of replicas are not available or there is network connection problem from the application node to Cassandra." --> I think the real problem comes from Cassandra and not Achilles ...
The Entity annotated with @Table has some json columns like: @Column private Map <String, @JSON Address>;
An Exception is thrown while reading such table having JSON type columns. I verified that the JSON is valid and also the write operation was executed successfully.
Following is the sample code, using Achilles core lib version 5.3.1, which throws the above exception: UserEntity userEntity = userEntityManager.dsl().select().allColumns_FromBaseTable().where().userId().Eq(userId).getOne();
Exception: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input at [Source: ; line: 1, column: 0] at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3854) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3799) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2896) at info.archinnov.achilles.internals.codec.JSONCodec.decode(JSONCodec.java:80) ... 49 common frames omitted Wrapped by: info.archinnov.achilles.exception.AchillesTranscodingException: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input at [Source: ; line: 1, column: 0] at info.archinnov.achilles.internals.codec.JSONCodec.decode(JSONCodec.java:82) at info.archinnov.achilles.internals.codec.JSONCodec.decode(JSONCodec.java:32) at info.archinnov.achilles.internals.metamodel.SimpleProperty.decodeFromRawInternal(SimpleProperty.java:121) at info.archinnov.achilles.internals.metamodel.AbstractProperty.decodeFromRaw(AbstractProperty.java:144) at info.archinnov.achilles.internals.metamodel.MapProperty.lambda$decodeFromRawInternal$630(MapProperty.java:212)
I found that, this exception used to happen when there is a connection problem with Cassandra node like min. required replicas are not available (I'm using read and write consistency: LOCAL_QUORUM). I referred similar problem: https://stackoverflow.com/questions/26925058/no-content-to-map-due-to-end-of-input-jackson-parser
Is there any other issue apart from the connection issue?