0

I am getting this error in my source code:

java.lang.NoSuchMethodError: org.apache.hadoop.hbase.HColumnDescriptor.setMaxVersions(I)V

when I upgraded from hbase-0.92.1-cdh4.1.1 to hbase-0.94.2-cdh4.2.0 I see that the signature of the method is changed from

public void setMaxVersions(int maxVersions)

to

public HColumnDescriptor setMaxVersions(int maxVersions)

I am guessing there is binary compatibility is lost. Could someone shed some light on how this can be resolved? Thanks.

4

1 回答 1

1

您可以使用 Java 反射来执行此操作:

HColumnDescriptor fam1 = new HColumnDescriptor(Bytes.toBytes('cf'));
Method method = fam1.getClass().getMethod("setMaxVersions", Integer.TYPE);
method.invoke(fam1, 10);
于 2014-01-10T15:53:04.833 回答