Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.bson.types.ObjectId cannot be cast to com.mongodb.DBObject

1,075 views
Skip to first unread message

MaRaVaN

unread,
Oct 6, 2011, 5:27:06 PM10/6/11
to Morphia
Hi,

Recently i have changed a embedded List of ObjectId(List<ObjectId>) to
a List of SomeClass(List<SomeClass>),

I have fixed all of the getter setter issues came up in the
application. But after that, when i try to fetch any document,
the following error is coming up. The application is screwed badly.
Does anyone know what may cause the issue.

Caused by: java.lang.RuntimeException: java.lang.ClassCastException:
org.bson.types.ObjectId cannot be cast to com.mongodb.DBObject
at
com.google.code.morphia.mapping.EmbeddedMapper.fromDBObject(EmbeddedMapper.java:
146)
at com.google.code.morphia.mapping.Mapper.readMappedField(Mapper.java:
503)
at com.google.code.morphia.mapping.Mapper.fromDb(Mapper.java:480)
... 13 more
Caused by: java.lang.ClassCastException: org.bson.types.ObjectId
cannot be cast to com.mongodb.DBObject
at
com.google.code.morphia.mapping.EmbeddedMapper.readCollection(EmbeddedMapper.java:
167)
at
com.google.code.morphia.mapping.EmbeddedMapper.fromDBObject(EmbeddedMapper.java:
119)
... 15 more


Thanks

Tamil Vendhan K

Scott Hernandez

unread,
Oct 6, 2011, 5:39:53 PM10/6/11
to mor...@googlegroups.com
On Thu, Oct 6, 2011 at 5:27 PM, MaRaVaN <sendm...@gmail.com> wrote:
> Hi,
>
> Recently i have changed a embedded List of ObjectId(List<ObjectId>) to
> a List of SomeClass(List<SomeClass>),

I have no idea what this means. What is this syntax? ObjectId(List<ObjectId>)

> I have fixed all of the getter setter issues came up in the
> application. But after that, when i try to fetch any document,
> the following error is coming up. The application is screwed badly.
> Does anyone know what may cause the issue.

Please include the full stack and your class def, and sample output
from the mongo shell.

MaRaVaN

unread,
Oct 7, 2011, 12:04:13 PM10/7/11
to Morphia
Pardon me scott,

Due to that error, i was scared and i revert all my code change, then
re did everything from the beginning.
Now its working as expected. I don't know what went wrong.

Thank you for your concern.

Tamil Vendhan K
Reply all
Reply to author
Forward
0 new messages