If you are trying to save a whole simple java object into Aerospike database and your are getting the following annoying errors.
com.aerospike.client.AerospikeException$Serialize: Error Code -1: java.io.NotSerializableException: com.sangnak-science.Person
at com.aerospike.client.Value$BlobValue.estimateSize(Value.java:977)
at com.aerospike.client.command.Command.estimateOperationSize(Command.java:767)
at com.aerospike.client.command.Command.setWrite(Command.java:76)
at com.aerospike.client.command.WriteCommand.writeBuffer(WriteCommand.java:56)
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:47)
at com.aerospike.client.AerospikeClient.put(AerospikeClient.java:339)
at com.yatra.Aerospike.main(Aerospike.java:57)
Caused by: java.io.NotSerializableException: com.yatra.Person
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at com.aerospike.client.Value$BlobValue.estimateSize(Value.java:971)
... 6 more
Don't worry it's very easy to handle this exception. All you need to find the class(In the above case the underlilned blue word) of the object (you are trying to save in Aerospike database) and make it Serializable by implementing the java.io.Serializable interface.
For the reference example please follow the below link.
com.aerospike.client.AerospikeException$Serialize: Error Code -1: java.io.NotSerializableException: com.sangnak-science.Person
at com.aerospike.client.Value$BlobValue.estimateSize(Value.java:977)
at com.aerospike.client.command.Command.estimateOperationSize(Command.java:767)
at com.aerospike.client.command.Command.setWrite(Command.java:76)
at com.aerospike.client.command.WriteCommand.writeBuffer(WriteCommand.java:56)
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:47)
at com.aerospike.client.AerospikeClient.put(AerospikeClient.java:339)
at com.yatra.Aerospike.main(Aerospike.java:57)
Caused by: java.io.NotSerializableException: com.yatra.Person
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at com.aerospike.client.Value$BlobValue.estimateSize(Value.java:971)
... 6 more
Don't worry it's very easy to handle this exception. All you need to find the class(In the above case the underlilned blue word) of the object (you are trying to save in Aerospike database) and make it Serializable by implementing the java.io.Serializable interface.
For the reference example please follow the below link.
Comments
Post a Comment