I'm building an inverted index and currently getting a null pointer exception in reduce when using context.write. Can anyone spot why? I presume something to do with serialising as I've never done that before? The error also happens when I print out h.
0
votes
it would be great if you can add a stacktrace to your question.
- Thomas Jungblut
@ThomasJungblut I've modified the code as you have suggested, other than the setClass method. Where might I override this from?
- user4331904
why did you edit to remove the stacktrace and code?
- vefthym
@vefthym Seemed the example I gave was irrelevant to the actual cause of the problem. I could put the relevant code in for brevity if preferred?
- user4331904
2 Answers
0
votes
Two things that I can spot directly regarding the serialization without a stacktrace:
- HMapValue needs a default constructor, it can't be created by Hadoop without one
- In the default constructor you need to initialize the
ArrayListWritablecorrectly (not null and it needs thesetClassmethod to deserialize correctly.