Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Spring boot native image can not serialize protobuf object

$
0
0

I have a method

  @Cacheable(value = USER_IDENTITIES_PROTO_CACHE)    public UserIdentitiesResponseOuterClass.UserIdentitiesResponse findUserIdentitiesProto(UUID userId) {

where UserIdentitiesResponseOuterClass.UserIdentitiesResponse is a class generated by protobuff.

When using JVM everything works well but in the native image I am getting the exception

"Failure putting into cache: user_identities_proto. Cannot serialize"

I have tried to add

 hints.serialization()                .registerType(TypeReference.of(UserIdentitiesResponseOuterClass.class))                .registerType(UserIdentitiesResponseOuterClass.UserIdentity.class)                .registerType(UserIdentitiesResponseOuterClass.UserIdentitiesResponse.class);

but it did not help.

I am using Redis as a cache and using JdkSerializationRedisSerializer to serialize.

Content of proto file below:

syntax = "proto3";package identity;message UserIdentity {  string provider = 1;  string sub = 2;}message UserIdentitiesResponse {  UserIdentity primary = 1;  repeated UserIdentity identities = 2;}

How to fix it?


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>