Since your code uses mrunit which hbase 0.98 is not dependent on, have you
considered asking this question on:
mrunit-u...@incubator.apache.org

Cheers

On Sun, Nov 2, 2014 at 1:22 PM, Serega Sheypak <serega.shey...@gmail.com>
wrote:

>  public static Put createPut(DynamicObjectSerDe<ItemRecommendation> serde,
> ItemRecommendation item, String columnFamily){
>         Put put = new Put(Bytes.toBytes(Long.valueOf(item.getId())));
>         put.add(Bytes.toBytes(columnFamily), Bytes.toBytes(item.getRank()),
> serde.serialize(item));
>         return put;
>     }
>
> 2014-11-03 0:12 GMT+03:00 Ted Yu <yuzhih...@gmail.com>:
>
> > bq. PutFactory.createPut(
> >
> > Can you reveal how PutFactory creates the Put ?
> >
> > Thanks
> >
> > On Sun, Nov 2, 2014 at 1:02 PM, Serega Sheypak <serega.shey...@gmail.com
> >
> > wrote:
> >
> > > Hi, I'm migrating from CDH4 to CDH5 (hbase 0.98.6-cdh5.2.0)
> > > I had a unit test for mapper used to create HFile and bulk load later.
> > >
> > > I've bumped maven deps from cdh4 to cdh5 0.98.6-cdh5.2.0
> > > Now I've started to get exception
> > >
> > > java.lang.IllegalStateException: No applicable class implementing
> > > Serialization in conf at io.serializations: class
> > > org.apache.hadoop.hbase.client.Put
> > > at
> > com.google.common.base.Preconditions.checkState(Preconditions.java:149)
> > > at
> > >
> > >
> >
> org.apache.hadoop.mrunit.internal.io.Serialization.copy(Serialization.java:75)
> > > at
> > >
> > >
> >
> org.apache.hadoop.mrunit.internal.io.Serialization.copy(Serialization.java:97)
> > > at
> > >
> > >
> >
> org.apache.hadoop.mrunit.internal.output.MockOutputCollector.collect(MockOutputCollector.java:48)
> > > at
> > >
> > >
> >
> org.apache.hadoop.mrunit.internal.mapreduce.AbstractMockContextWrapper$4.answer(AbstractMockContextWrapper.java:90)
> > > at
> > >
> > >
> >
> org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:34)
> > > at
> > >
> > >
> >
> org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:91)
> > > at
> > >
> > >
> >
> org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29)
> > > at
> > >
> > >
> >
> org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:38)
> > > at
> > >
> > >
> >
> org.mockito.internal.creation.MethodInterceptorFilter.intercept(MethodInterceptorFilter.java:51)
> > > at
> > >
> > >
> >
> org.apache.hadoop.mapreduce.Mapper$Context$$EnhancerByMockitoWithCGLIB$$ba4633fb.write(<generated>)
> > >
> > >
> > > And here is mapper code:
> > >
> > >
> > >
> > > public class ItemRecommendationHBaseMapper extends Mapper<LongWritable,
> > > BytesWritable, ImmutableBytesWritable, Put> {
> > >
> > >     private final ImmutableBytesWritable hbaseKey = new
> > > ImmutableBytesWritable();
> > >     private final DynamicObjectSerDe<ItemRecommendation> serde = new
> > > DynamicObjectSerDe<ItemRecommendation>(ItemRecommendation.class);
> > >
> > >     @Override
> > >     protected void map(LongWritable key, BytesWritable value, Context
> > > context) throws IOException, InterruptedException {
> > >         checkPreconditions(key, value);
> > >         hbaseKey.set(Bytes.toBytes(key.get()));
> > >
> > >         ItemRecommendation item = serde.deserialize(value.getBytes());
> > >         checkPreconditions(item);
> > >         Put put = PutFactory.createPut(serde, item, getColumnFamily());
> > >
> > >         context.write(hbaseKey, put); //Exception here
> > >     }
> > >
> > > Whatcan i do in order to make unit-test pass?
> > >
> >
>

Reply via email to