Performing a MapReduce query on a simple bucket. For some reason, I am getting an exception from Jackson:
Caused by: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of com.threetierlogic.AccountService.models.User out of START_ARRAY token
at [Source: java.io.StringReader@39494ff0; line: 1, column: 2]
at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163)
at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219)
at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:212)
... 179 more
Here's the MapReduce Query I am performing:
DB.client.mapReduce(bucketName)
.addReducePhase(NamedErlangFunction.REDUCE_IDENTITY)
.execute().getResult(classOf[User])
Now if I call the JSON using getResultRaw()
it returns a string of JSON that contains no values, only keys:
[["accounts-user","8f0bb6e41592690d701225e263807a5e"],["accounts-user","2687cf9444013c45ba2637e9f6d3d3ad"],["accounts-user","3507e2e1f3d2818fdd276214d594c8e"],["accounts-user","fd186b0293ab7eb737f8b66e353fe4a6"],["accounts-user","bf6ce6bca0f642abfe74f2e2281e676c"],["accounts-user","b58d356551a8df6d3bbaf65e577f4b12"],["accounts-user","8126d599d259fd43f701c90787096049"],["accounts-user","33b9ae3befb23b7030b609158bb762d"],["accounts-user","770a897d5ce8c8e118ae121fc01f4c80"],["accounts-user","edae605390c35256b5df055f5574734d"],["accounts-user","ef19ad34a2be4ab8de111d1590a8768b"],["accounts-user","89a9f29ac937595038d37169f9ba7c8"],["accounts-user","85be26f43f7bb74eefa7683dcc74c555"]]
So what am I overlooking here? Do I need to invoke some sort of domain converter or is the problem in the MapReduce query itself?
Edit
If it helps, here's how I store IRiakObjects
in Riak:
def store(o: User) = bucket.store(o).withConverter(new UserConverter(bucketName)).execute()