HazelcastSerializationException while getting entity from IMAP

254 views
Skip to first unread message

Alexander Bogdanov

unread,
Mar 10, 2022, 9:01:10 AM3/10/22
to Hazelcast
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 



Ahmet Mircik

unread,
Mar 18, 2022, 8:10:03 AM3/18/22
to haze...@googlegroups.com

Hi, this seems like you have different id than registered one.
I’m seeing in the snippet //todo replace with hardcode integer (must be the same in all instances), did you tr with a fixed value?
If this doesn’t help, you can share a full working reproducer here.


--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/08c23fe5-a330-4357-8afa-fd176e34bb2fn%40googlegroups.com.

This message contains confidential information and is intended only for the individuals named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required, please request a hard-copy version. -Hazelcast
Reply all
Reply to author
Forward
0 new messages