Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected error executing a simple map reduce operation #196

Closed
jfcorugedo opened this issue Feb 24, 2016 · 2 comments
Closed

Unexpected error executing a simple map reduce operation #196

jfcorugedo opened this issue Feb 24, 2016 · 2 comments
Milestone

Comments

@jfcorugedo
Copy link

I want to use fongo (1.5.10 and 1.6.6) to test a very simple map reduce operation of my application.

During the execution of the map reduce, fongo trhows an unexpected error:

java.lang.RuntimeException: json can't serialize type : class org.mozilla.javascript.gen.c1 at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:77) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSONSerializers$IterableSerializer.serialize(JSONSerializers.java:290) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317) at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79) at com.mongodb.util.JSON.serialize(JSON.java:54) at com.mongodb.util.JSON.serialize(JSON.java:40) at com.mongodb.BasicDBObject.toString(BasicDBObject.java:97) at java.lang.String.valueOf(String.java:2981) at java.lang.StringBuilder.append(StringBuilder.java:131) at com.mongodb.FongoDBCollection.insert(FongoDBCollection.java:114) at com.mongodb.DBCollection.insert(DBCollection.java:161) ...

The problem is in this line (FongoDBCollection.java:114):

  DBObject cloned = filterLists(Util.cloneIdFirst(encodeDecode(obj, encoder)));
  if (LOG.isDebugEnabled()) {
       LOG.debug("insert: " + cloned);
  }

When Logger tries to obtain a String representation of cloned object, it throws a RuntimeException.

If I turn off DEBUG traces of that class (<logger name="com.mongodb" level="INFO"/>) then everything works.

Can you take a look?

Thanks!

@twillouer twillouer added this to the 1.6.7 milestone Mar 7, 2016
@twillouer
Copy link
Collaborator

Hi,

can you try against the master branch ?

I don't know exactly your set of test, can you provide me a simple case ?

@jfcorugedo
Copy link
Author

Ok, I've tested your change and now it doesn't fail, but it doesn't print the content of the object either.

This line:

LOG.debug("insert:  {}", cloned);

Outputs this trace:

2016-03-08 12:37:47,141 [DEBUG] [main] com.mongodb.FongoDBCollection - insert:  [FAILED toString()]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants