Jersey Rest - JsonMappingException: No suitable constructor found for type [simple type, class ]
You can implement custom JsonSerializer
object and register it into Jackson context.
public class EncryptionTokenSerializer extends JsonSerializer<EncryptionToken> { @Override public void serialize(EncryptionToken value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeStartObject(); jgen.writeBinaryField("encoded", value.getEncoded()); jgen.writeBinaryField("base64Encoded", value.getBase64Encoded()); jgen.writeEndObject(); }}
If you want to know how to register serializer in the context check this answer
Hey I tried your code on my machine. I didn't have any problem executing it.It's giving me proper result.Can you provide implementation of method 'etkService.getETK()' and the declaration & definition of 'etkService'. There may be some problem due to that.
final EncryptionToken token = etkService.getETK(etkIdentifierType, etkIdentifierValue, applicationId);
And it is not necessary to provide the deserializer for your POJO