Skip to content

GPMONGODB-90: java.lang.ClassCastException: com.mongodb.DBPointer cannot be cast to java.io.Serializable after update through MongoHub #159

@graemerocher

Description

@graemerocher

Original Reporter: danpolites
Environment: Mac OS X Lion, Java 6
Version: 1.0.0.M7
Migrated From: http://jira.grails.org/browse/GPMONGODB-90

I wasn't sure if this belonged here (could be a mongohub issue), but it's something to be aware of. I used MongoHub, version 2.3.2[73], to update a property on a document that contains the following $ref after the m7 upgrade:

"customer" : { "$ref" : "user", "$id" : "4df21715e9f53cf9570c5b15" }

After I saved the document, MongoHub converted all of the $refs in the document to this:

"customer" : Dbref( "user", "4df21715e9f53cf9570c5b15" )

Which then causes the application to throw the exception below. The mongo shell (v1.8.2) does not convert the $refs, and changing the DBrefs back to $refs fixes the issue.

2011-08-18 08:22:36,562 [http-8080-5] ERROR (category: StackTrace) (class: grails.util.GrailsUtil) (location: grails.util.GrailsUtil.sanitize(GrailsUtil.java:260)) (line: 260) (ndc: ) (method: sanitize) - Sanitizing stacktrace:
java.lang.ClassCastException: com.mongodb.DBPointer cannot be cast to java.io.Serializable
at org.grails.datastore.mapping.engine.NativeEntryEntityPersister.refreshObjectStateFromNativeEntry(NativeEntryEntityPersister.java:401)
at org.grails.datastore.mapping.engine.NativeEntryEntityPersister.createObjectFromNativeEntry(NativeEntryEntityPersister.java:354)
at org.grails.datastore.mapping.engine.NativeEntryEntityPersister.retrieveEntity(NativeEntryEntityPersister.java:321)
at org.grails.datastore.mapping.engine.EntityPersister.retrieve(EntityPersister.java:158)
at org.grails.datastore.mapping.core.AbstractSession.retrieve(AbstractSession.java:500)
at org.grails.datastore.mapping.core.Session$retrieve.call(Unknown Source)
at org.grails.datastore.gorm.GormStaticApi$4.doInSession(GormStaticApi.groovy:150)
at org.grails.datastore.mapping.core.DatastoreUtils.execute(DatastoreUtils.java:301)
at org.grails.datastore.mapping.core.DatastoreUtils$execute.call(Unknown Source)
at org.grails.datastore.gorm.AbstractDatastoreApi.execute(AbstractDatastoreApi.groovy:34)
at sun.reflect.GeneratedMethodAccessor338.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:266)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at org.grails.datastore.gorm.GormStaticApi.read(GormStaticApi.groovy:148)
at sun.reflect.GeneratedMethodAccessor384.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1070)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:793)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:776)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:163)
at org.grails.datastore.gorm.StaticMethodInvokingClosure.call(GormEnhancer.groovy:268)
at org.codehaus.groovy.runtime.metaclass.ClosureStaticMetaMethod.invoke(ClosureStaticMetaMethod.java:59)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:148)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:88)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions