Hi guys, So I have just tried putting and getting elements (Nutch's WebPage) entries specifically and everything works fine. So this is confusing, I guess Nutch is doing something in the middle there that may have to do with the mapping file or something like it. Because I tried changing the key type (from String to Utf8) and gave an unrelated error saying that the collection hadn't been defined (which is not true), I would have expected to get a classCastException. And the other weird thing is that when performing a get using a query object I end up with a bunch of MongoResults instead of WebPages. I think that is bug (or . . . a feature) that we are not aware of. Maybe Damian can help us out here. I will keep on pocking around, but gora-mongodb is getting the data in, and it is able to take it out.
Renato M. 2014-10-10 9:17 GMT+02:00 Kiril Menshikov <p...@kiril.me>: > Tyler, > > MongoDb doesn’t support Serializable interface. BasicBSONEncoder has > direct class checks. Unfortunately it's not enough to make Utf8 > serializable. > > -Kiril > > On Oct 9, 2014, at 21:44, Lewis John Mcgibbney <lewis.mcgibb...@gmail.com> > wrote: > > > Hi Folks, > > Whilst in the muddle of upgrading Nutch 2.3-SNAPSHOT to use Gora 0.5 > we've run into a problem when implementing the gora-mongodb stuff. > > The issue is described within the Jira issue [0]. This being said, Kiril > (CC'd) has stated quite clearly why this is happening. This is a > consequence of the following lines of the Nutch code base > > > > > https://github.com/apache/nutch/blob/2.x/src/java/org/apache/nutch/fetcher/FetcherJob.java#L218 > > > > > https://github.com/apache/nutch/blob/2.x/src/java/org/apache/nutch/parse/ParserJob.java#L274 > > > > > https://github.com/apache/nutch/blob/2.x/src/java/org/apache/nutch/crawl/DbUpdaterJob.java#L128 > > > > and results in the following stack trace > > java.lang.IllegalArgumentException: can't serialize class > org.apache.avro.util.Utf8 > > at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:284) > > at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:185) > > at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:131) > > at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:33) > > at com.mongodb.OutMessage.putObject(OutMessage.java:289) > > at com.mongodb.OutMessage.writeQuery(OutMessage.java:211) > > at com.mongodb.OutMessage.query(OutMessage.java:86) > > at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:81) > > at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:66) > > at com.mongodb.DBCursor._check(DBCursor.java:458) > > at com.mongodb.DBCursor._hasNext(DBCursor.java:546) > > at com.mongodb.DBCursor.hasNext(DBCursor.java:571) > > at > org.apache.gora.mongodb.query.MongoDBResult.nextInner(MongoDBResult.java:69) > > at org.apache.gora.query.impl.ResultBase.next(ResultBase.java:114) > > at > org.apache.gora.mapreduce.GoraRecordReader.nextKeyValue(GoraRecordReader.java:119) > > at > org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:531) > > at > org.apache.hadoop.mapreduce.MapContext.nextKeyValue(MapContext.java:67) > > at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144) > > at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764) > > at org.apache.hadoop.mapred.MapTask.run(MapTask.java:364) > > at > org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:223) > > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) > > at java.util.concurrent.FutureTask.run(FutureTask.java:262) > > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > > at java.lang.Thread.run(Thread.java:744) > > > > The cause is the following line (example from FetcherJob): > > filter.getOperands().add(new Utf8(batchId)); > > > > During serialization MongoDB doesn't know about Utf8 type. > > > > My question is now... should we remove the Utf8 from Nutch, or should > gora-mongodb handle this silently? > > > > Thanks for reading. > > Lewis > > > > [0] https://issues.apache.org/jira/browse/NUTCH-1843 > > > > -- > > Lewis > >