Quantcast

MongoDB plugin -- something 'used to work'

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

MongoDB plugin -- something 'used to work'

rstudner
I think it might be related to this:

I took an old app, I think I was running M4?.. upgraded it to the latest mongodb plugin etc.

Now, when I try to persist one of my 3 tiny little domain objects, I get this:

java.lang.IllegalArgumentException: can't serialize class com.foo.AnalyticItem
	at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:234)
at org.bson.BasicBSONEncoder.putIterable(BasicBSONEncoder.java:259)
at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:198)
at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:140)
at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:86)
at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27)
at com.mongodb.OutMessage.putObject(OutMessage.java:142)
etc...
I never in the past had any problems serializing the class:
package com.foo
import  org.bson.types.ObjectId

class AnalyticItem {
    ObjectId id
    List ip
    Date date
    String action
    String featureName
    String sid
    String pid
    String uid
    String url
    String agent
    String clientProductId

    static constraints = {
        featureName(nullable: true)
        clientProductId(nullable: true)
        pid(nullable:true)
        uid(nullable:true)
    }
}

thoughts?

Thanks,
Roger

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: MongoDB plugin -- something 'used to work'

rstudner
Addendum.. this error comes up, when I try to save one of these:

class UserSession {
    ObjectId id

    Set<AnalyticItem> sessionAnalytics
    Date sessionStartDate
    String sid

    static mapping = {
        sid index: true, indexAttributes: [unique: true, dropDups: true]
    }
}

did something change, where now i'd have to do:

class Person {
    String firstName
    String lastName
    Address address
    List otherAddresses
    static embedded = ['address', 'otherAddresses']
}

Basically have:
List sessionAnalytics
static embedded = ['sessionAnalytics']

I didn't think I had to explicity make another domain object embedded to relate them, but that is the only example shown in the GORM MongoDb docs

Thanks,
Roger




On Dec 20, 2011, at 8:15 PM, Roger Studner wrote:

I think it might be related to this:

I took an old app, I think I was running M4?.. upgraded it to the latest mongodb plugin etc.

Now, when I try to persist one of my 3 tiny little domain objects, I get this:

java.lang.IllegalArgumentException: can't serialize class com.foo.AnalyticItem
	at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:234)
at org.bson.BasicBSONEncoder.putIterable(BasicBSONEncoder.java:259)
at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:198)
at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:140)
at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:86)
at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27)
at com.mongodb.OutMessage.putObject(OutMessage.java:142)
etc...
I never in the past had any problems serializing the class:
package com.foo
import  org.bson.types.ObjectId

class AnalyticItem {
    ObjectId id
    List ip
    Date date
    String action
    String featureName
    String sid
    String pid
    String uid
    String url
    String agent
    String clientProductId

    static constraints = {
        featureName(nullable: true)
        clientProductId(nullable: true)
        pid(nullable:true)
        uid(nullable:true)
    }
}

thoughts?

Thanks,
Roger


Loading...