Hi,
Main info:
* StackTrace:
com.hazelcast.nio.serialization.HazelcastSerializationException: There is no suitable de-serializer for type 107879210. This exception is likely caused by differences in the serialization configuration between members or between clients and members.
at com.hazelcast.internal.serialization.impl.AbstractSerializationService.newHazelcastSerializationException(AbstractSerializationService.java:256)
at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toObject(AbstractSerializationService.java:200)
at com.hazelcast.map.impl.proxy.MapProxySupport.toObject(MapProxySupport.java:1286)
at com.hazelcast.map.impl.proxy.MapProxyImpl.get(MapProxyImpl.java:117)
* Configuration:
<code>
config.apply {
serializationConfig.addSerializerConfig(
SerializerConfig().apply {
implementation = InstallationToFromCacheSerializer
typeClass = Installation::class.java
}
)
mapConfigs[INSTALLATION_CACHE_NAME] = MapConfig().apply {
evictionConfig = EvictionConfig().apply {
evictionPolicy = EvictionPolicy.LRU
maxSizePolicy = MaxSizePolicy.FREE_HEAP_PERCENTAGE
size = 20
}
nearCacheConfig = NearCacheConfig().apply {
inMemoryFormat = InMemoryFormat.OBJECT
isInvalidateOnChange = true
evictionConfig = EvictionConfig().apply {
evictionPolicy = EvictionPolicy.LRU
maxSizePolicy = MaxSizePolicy.ENTRY_COUNT
size = 4_000_000
}
}
maxIdleSeconds = 0
timeToLiveSeconds = 86400
name = INSTALLATION_CACHE_NAME
backupCount = 0
asyncBackupCount = 0
}
}
</code>
* Serializer:
<code>
object InstallationToFromCacheSerializer : ByteArraySerializer<Installation> {
val conf: FSTConfiguration = FSTConfiguration.createUnsafeBinaryConfiguration()
init {
conf.isForceSerializable = true
}
override fun getTypeId(): Int = Installation::class.java.hashCode() //todo replace with hardcode integer (must be the same in all instances)
override fun write(installation: Installation): ByteArray = conf.asByteArray(installation)
override fun read(bytes: ByteArray): Installation = conf.getObjectInput(bytes).readObject() as Installation
}
</code>
* Entity:
<code>
@JsonApiResource(type = "installations")
@JsonIgnoreProperties(ignoreUnknown = true)
data class Installation(
@JsonApiId var id: String? = null,
var pid: Int? = 0,
var devType: Int? = 0,
var creAt: Date? = null,
var appVer: String? = ZERO_VERSION,
var osVer: String? = ZERO_VERSION,
var abGroupId: Int? = null,
var lastUserId: String? = null,
var spec: Specification? = null,
var bundleId: String? = null,
var source: InstallationSource? = null,
var riskMode: InstallationRisk? = null,
) : Serializable {
var metaInformation = InstallationMeta(lastUserId, null, null, null, null, spec?.lastIssueDate)
@JsonIgnoreProperties(ignoreUnknown = true)
data class Specification(
@JsonProperty
var lastIssueDate: Date? = null
)
fun getProject(): Project? = pid?.let(Project::fromId)
fun getCreatedAt(): Date? = creAt
fun getDeviceType(): InstallationDeviceType? = devType?.let(InstallationDeviceType::fromId)
fun getApplicationVersion(): Version = Versions.parseVersion(appVer)
fun getOsVersion(): Version = Versions.parseVersion(osVer)
fun getGroup(): Int? = abGroupId
fun getIdAsString(): String = id!!
fun getMeta() = metaInformation
data class InstallationMeta(
val userId: String?,
val advId: String?,
val brand: String?,
val model: String?,
val manufacturer: String?,
val lastIssueDate: Date?
) : Serializable {
companion object {
private const val serialVersionUID = 1L
}
}
companion object {
private const val ZERO_VERSION = "0.0.0"
private const val serialVersionUID = 1L
}
}
</code>
* Test for serialisation:
<code>
@Test
fun `Can be serialized and deserialized`() {
val input = Installation(id = "1", pid = Project.id, osVer = null, appVer = null)
val serialized = SerializationUtils.serialize(input)
val output: Installation = SerializationUtils.deserialize(serialized)
assertEquals(input, output)
}
</code>
There is no obvious issues with configuration or with entity could you give any advise for debugging or finding solution.
Best regards