Problem with internal Casting java.lang.Integer to com.orientechnologies.orient.core.db.record.OIdentifiable

41 views
Skip to first unread message

Joseph A

unread,
Dec 7, 2016, 10:28:54 AM12/7/16
to BaasBox
Hello guys,

I'm having this problem happening multiple times (being logged a lot of time and making the Baasbox instance to shutdown at some point).

Basically what I can see in the logs is that is throwing an exception because it can't cast the field @version from Java Integer to the OIdentifiable of OrientDB (my plugin code doesn't change @version at any point, never, and from what I understand, Integer is the correct type for that attribute).

Here are some relevant parts of the stack trace:


2016-12-07 02:42:08,346 - ERROR - com.orientechnologies: play-akka.actor.default-dispatcher-148  Fetching error on record #25:136
java
.lang.ClassCastException: java.lang.Integer cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable
        at com
.orientechnologies.orient.core.db.record.ORecordLazyMap.put(ORecordLazyMap.java:37) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
        at com
.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.embeddedMapFromStream(ORecordSerializerCSVAbstract.java:315) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]


com
.orientechnologies.orient.core.exception.OSerializationException: Cannot load map because the type was not the expected: key=@version(type class java.lang.String), value=1(type class java.lang.String)
        at com
.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.embeddedMapFromStream(ORecordSerializerCSVAbstract.java:318) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
        at com
.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.fieldFromStream(ORecordSerializerCSVAbstract.java:211) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
        at com
.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerSchemaAware2CSV.fromString(ORecordSerializerSchemaAware2CSV.java:240) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]


com
.orientechnologies.orient.core.exception.OSerializationException: Error on unmarshalling field 'methodologyModelVersion' in record #25:136 with value: methodologyModelVersion:{"@rid":#54:1,"@version":1,"@class":"methodology_model_version","add":{"disciplines":[],"practices":[],"questions":[]},"remove":{"disciplines":[],"practices":[],"questions":[]},"created":1475852427016l,"version_number":0,"bb_methodology_model":#33:1,"id":"3650e745-c444-45e2-96cb-57e4b32a69fe","_creation_date":"2016-10-07T15:00:27.027+0000","_author":"admin","objectId":"3650e745-c444-45e2-96cb-57e4b32a69fe"}


Baasbox version: V. 1.0.0-M3-20151004-nightly

Reading a bit this seems to be a known bug in OrientDB but I just want to make sure that this is the case, do you guys have any idea of this one? a possible workaround in the meantime? I would really appreciate the help here.

Thanks in advance.


giastfader

unread,
Dec 7, 2016, 11:14:52 AM12/7/16
to BaasBox
Hi Joseph,
if you look closely at the exception you can see that the serializer cannot perform the unmarshalling of the field "methodologyModelVersion".

Actually the field content is an embedded json object:

methodologyModelVersion: {"@rid":#54:1,"@version":1,"@class":"methodology_model_version","add":{"disciplines":[],"practices":[],"questions":[]},"remove":{"disciplines":[],"practices":[],"questions":[]},"created":1475852427016l,"version_number":0,"bb_methodology_model":#33:1,"id":"3650e745-c444-45e2-96cb-57e4b32a69fe","_creation_date":"2016-10-07T15:00:27.027+0000","_author":"admin","objectId":"3650e745-c444-45e2-96cb-57e4b32a69fe"}

The real problem is that the embedded object has the "@rid" field.
This is a bug of ODB: it allows to store a JSON document containing a @RID, then it fails when tries to load it back.

There is no way, AFAIK, to avoid this problem.
You must not store a @rid field into an embedded document.

To clean up the database you have to perform a full export/import procedure, in this way the malformed records are not reimported back.


Joseph A

unread,
Dec 7, 2016, 11:27:40 AM12/7/16
to BaasBox
Hi giastdafer,

Make sense, I'll be able to solve the problem with the information you provided, thank you very much.
Reply all
Reply to author
Forward
0 new messages