Serialization Exception on WriteConcernResult

32 views
Skip to first unread message

Nestor Pan

unread,
May 10, 2017, 11:52:58 AM5/10/17
to Morphia
Hi,

I am using Morphia with Java RMI. I pass the entities to the client through RMI. This works fine, until I want to create an unique index on a couple of fields on an entitiy.
I get the NotSerializableException on the class WriteConcernResult:

java.rmi.UnmarshalException: Error unmarshaling return; nested exception is: 
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.mongodb.WriteConcernResult$1

I attempted to create the index using Morphia:

@Indexes(@Index(fields = {@Field("tipoComprobante"), @Field("letra"), @Field("puntoVenta"), @Field("numeroFactura"), @Field("proveedor")}, options = @IndexOptions(unique = true)))

And through the java driver:

IndexOptions indexOptions = new IndexOptions().unique(true);
mongoClient.getDatabase("SeguimientoFlotaChisap").getCollection("FacturaCompra").createIndex(Indexes.ascending("tipoComprobante", "letra", "puntoVenta", "nroFactura", "proveedor"), indexOptions);

In the 2 cases, I got the Exception.

It seems that an Object of class WriteConcernResult is getting  added to the entities.

It is weird that the error happens when I call a method throug RMI wich doesn't returns an entity. It simply returns an RMI proxy to a remote controller.

Thanks in advance.
Néstor

Reply all
Reply to author
Forward
0 new messages