hbase 执行批量删除时出现错误:
 Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.AbstractList.remove(AbstractList.java:161)
at org.apache.hadoop.hbase.client.HTable.delete(HTable.java:852)

这种异常其实很常见,remove操作不支持,为什么会出现不支持的情况呢?检查代码时发现传参list 是通过Arrays.asList()创建的,

很明显,问题就是这个地方导致的,Arrays.asList()返回是实际上是Arrays类内部的一个实现ArrayList:

   /**
* @serial include
*/
private static class ArrayList<E> extends AbstractList<E>
implements RandomAccess, java.io.Serializable
{
private static final long serialVersionUID = -2764017481108945198L;
private final E[] a; ArrayList(E[] array) {
if (array==null)
throw new NullPointerException();
a = array;
} public int size() {
return a.length;
} public Object[] toArray() {
return a.clone();
} public <T> T[] toArray(T[] a) {
int size = size();
if (a.length < size)
return Arrays.copyOf(this.a, size,
(Class<? extends T[]>) a.getClass());
System.arraycopy(this.a, 0, a, 0, size);
if (a.length > size)
a[size] = null;
return a;
} public E get(int index) {
return a[index];
} public E set(int index, E element) {
E oldValue = a[index];
a[index] = element;
return oldValue;
} public int indexOf(Object o) {
if (o==null) {
for (int i=0; i<a.length; i++)
if (a[i]==null)
return i;
} else {
for (int i=0; i<a.length; i++)
if (o.equals(a[i]))
return i;
}
return -1;
} public boolean contains(Object o) {
return indexOf(o) != -1;
}
}

Arrays.ArrayList继承至AbstractList,AbstractList本身是不支持删除操作的,Arrays.ArrayList也没有重现remove方法,因此,如果通过Arrays.asList()创建的ArrayList,如果调用了remove方法,则会出现UnsupportedOperationException异常。

Hbase delete遇到的常见异常: Exception in thread "main" java.lang.UnsupportedOperationException的更多相关文章

  1. Java常见异常:Exception in thread "main" java.lang.NoClassDefFoundError

    在某一路径下执行编译好的class文件出错. 异常如下: E:\liwy>java Test98 Exception in thread "main" java.lang.N ...

  2. Sqoop异常:Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONObject

    18/12/07 01:09:03 INFO mapreduce.ImportJobBase: Beginning import of staffException in thread "m ...

  3. dom4j使用xpath报异常 Exception in thread "main" java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext

    Exception in thread "main" java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext      ...

  4. unit测试出现异常:Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.commons.util

    在进行单元测试时,测试出现异常 Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform ...

  5. 异常Exception in thread "AWT-EventQueue-XX" java.lang.StackOverflowError

    今天太背了,bug不断,检查到最后都会发现自己脑残了,粗心写错,更悲剧的是写错的时候还不提示错. 刚才有遇到一个问题,抛了这个异常Exception in thread "AWT-Event ...

  6. CXF安装和配置时出现Exception in thread "main" java.lang.UnsupportedClassVersionError:异常?

    异常信息: C:\Users\>wsdl2java -h Exception in thread "main" java.lang.UnsupportedClassVersi ...

  7. 【异常】idea执行Main方法出现 Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

    一.异常复现步骤 1)首先得是一个Spring MVC项目 注:Spring Boot项目有内置的web 容器,不会出现该问题 2)main方法存在于使用HttpServletRequest类的类中 ...

  8. Java异常理解之Exception in thread “main“ java.lang.ArrayIndexOutOfBoundsException

    这个异常是Java中的数组越界问题 当你使用不合法的索引访问数组是会出现这种错误例如: class Solution { public static int climbStairs(int n) { ...

  9. Jenkins的slave异常:Exception in thread "main" java.lang.ClassNotFoundException: hudson.remoting.Launcher

    当任务分配到slave上执行时,报如下错误: Parsing POMs Established TCP socket on 38257 maven33-agent.jar already up to ...

随机推荐

  1. Hive 表数据的存储和压缩格式

    SerDe * 按行存储 * 按列存储 file_format: : | SEQUENCEFILE 序列化(行存储) | TEXTFILE 文本格式(行存储)- (Default, depending ...

  2. python面向对象三大特性

    面向对象的三大特性: 封装.继承和多态 一.封装 封装,顾名思义就是将内容封装到某个地方,以后可以直接调用被封装到某处的内容. - 将内容封装到某处 - 从某处调用被封装的内容 第一步,将内容封装到某 ...

  3. Java线程和多线程(八)——Thread Dump

    Java的Thread Dump就是列出JVM中所有激活状态的线程. Java Thread Dump Java Thread Dump在分析应用性能瓶颈和死锁的时候,是非常有效的. 下面将介绍多种不 ...

  4. Javascript Step by Step - 02

    DOM 操作 DOM是面向HTML和XML文档的API,为文档提供了结构化表示.在DOM中一切都是节点Node,文档就是由许多的Node组成的.文档里的每个节点都有属性 nodeName.nodeVa ...

  5. Hbase的安装与部署(集群版)

    HBase 部署与使用 部署 Zookeeper 正常部署 $ ~/modules/zookeeper-3.4.5/bin/zkServer.sh start 首先保证 Zookeeper 集群的正常 ...

  6. Webpack标准配置

    let htmlWebpckPlugin= require('html-webpack-plugin');//该组件能将src下面提定的html文件与打包后在js文件打包在一起module.expor ...

  7. 使用Matrix-tree与它的行列式来解决生成树计数问题

    我又把Matrix写错啦 这东西讲课的时候竟然一笔带过了,淦 好吧这东西我不会证 那我们来愉快的看结论吧 啦啦啦 预备工作 你有一个 $ n $ 个点的图 比如说 5 /|\ / | \ 2--1-- ...

  8. Active Directory-Integrated Zones

    更新时间: 2010年5月 应用到: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Window ...

  9. Percona-Tookit工具包之pt-summary

      Preface       As a dba,We are obliged to master several basic tools(such as vmstat,top,netstat,ios ...

  10. sources-t.list

    deb http://debian.ustc.edu.cn/ubuntu/ trusty main multiverse restricted universe deb http://debian.u ...