AmbGup
AmbGup

Reputation: 771

Serializer is not able to find my business classes and throws HazelcastSerializationException/ClassNotFoundException

In Memory Format - 'BINARY' works fine for storing objects in distibuted map.

hz:map name="mymap"  max-idle-seconds="0"  in-memory-format="BINARY"
backup-count="0" max-size="0" eviction-percentage="30" read-backup-data="true"
eviction- policy="NONE" />

Moment I change in-memory-format to "OBJECT". An error is thrown as:

com.hazelcast.nio.serialization.HazelcastSerializationException:
    java.lang.ClassNotFoundException:com.Customer

I am running a single node to start a hazelcast instance (hz:hazelcast id="instance")

I have another clinet configured (hz:client id="client") to put "Customer" in map as:

IMap<String, Customer> objectMap = hazelcast.getMap("mymap");  
Customer customer = new Customer("gupta", 33);  
objectMap.put(key , customer);

with OBJECT format the above exception is thrown.

Upvotes: 2

Views: 362

Answers (1)

AmbGup
AmbGup

Reputation: 771

To resove this problem I have to add "Customer" in classpath for node manager. This means node manager has to be aware of all the objects that can be added in map(s) at build phase.

Upvotes: 2

Related Questions