您好我是java的新手,我在运行JUnit测试用例时发现了这个错误。我在应用程序的DAO课程中遇到错误,我打电话给我的班级' TestDao'类。我使用eclipse作为我的IDE,但是当我做了“清理安装”时,我得到了这个错误。这也运行我的测试用例。错误堆栈来自surefire报告:
java.lang.VerifyError:操作数堆栈上的错误类型
异常详细信息:
位置: COM /服务/测试/刀/ TestDao.deleteAuditLogsForLabel(Ljava /郎/字符串;)V @ 62:invokespecial
原因: 类型org / apache / hadoop / hbase / filter / SubstringComparator(当前帧,堆栈[5])不能分配给 组织/阿帕奇/ hadoop的/ HBase的/过滤/ ByteArrayComparable
当前框架: bci:@ 62
标志:{}
locals:{com / services / test / dao / TestDao,java / lang / String,org / apache / hadoop / hbase / client / HTable, org / apache / hadoop / hbase / filter / FilterList,java / lang / String, java / lang / String,org / apache / hadoop / hbase / filter / SubstringComparator}
stack:{uninitialized 42,uninitialized 42,[B,[B,org / apache / hadoop / hbase / filter / CompareFilter $ CompareOp, org / apache / hadoop / hbase / filter / SubstringComparator}
以下是TestDao.deleteAuditLogsForLabel方法。
public void deleteAuditLogsForLabel(String netElementId) {
try {
HTable auditlogTable = new HbaseCore()
.getHtable(DatabaseConstants.AUDITTABLE);
FilterList filterList = new FilterList(
FilterList.Operator.MUST_PASS_ALL);
String columnFamily = DatabaseConstants.AUDITTABLE;
String netId = netElementId;
SubstringComparator netElementIdComparator = new SubstringComparator(
netId);
SingleColumnValueFilter subObjectNameFilter = new SingleColumnValueFilter(
Bytes.toBytes(columnFamily),
Bytes.toBytes(DatabaseConstants.SUB_OBJECT_NAME),
CompareOp.EQUAL, netElementIdComparator);
SingleColumnValueFilter subCategoryFilter = new SingleColumnValueFilter(
Bytes.toBytes(columnFamily),
Bytes.toBytes(DatabaseConstants.SUB_CATEGORY),
CompareOp.EQUAL, Bytes.toBytes(Constants.SYSTEM_LABEL));
SingleColumnValueFilter usernameFilter = new SingleColumnValueFilter(
Bytes.toBytes(columnFamily),
Bytes.toBytes(DatabaseConstants.USER_NAME),
CompareOp.EQUAL, Bytes.toBytes(Constants.MACHINE_NAME));
SingleColumnValueFilter categoryFilter = new SingleColumnValueFilter(
Bytes.toBytes(columnFamily),
Bytes.toBytes(Constants.CATEGORY), CompareOp.EQUAL,
Bytes.toBytes(Constants.LABEL_MODULE));
filterList.addFilter(subObjectNameFilter);
filterList.addFilter(subCategoryFilter);
filterList.addFilter(usernameFilter);
filterList.addFilter(categoryFilter);
Scan scan = new Scan();
scan.setFilter(filterList);
ResultScanner resultScanner = auditlogTable.getScanner(scan);
List<Delete> deletes = new ArrayList<Delete>();
for (Result result : resultScanner) {
String rowID = Bytes.toString(result.getRow());
Delete delete = new Delete(Bytes.toBytes(rowID));
deletes.add(delete);
}
auditlogTable.delete(deletes);
} catch (Exception e) {
LOGGER.logRuntimeError(e);
}
}
我读到了如何解决&#39; java.lang.VerifyError&#39;错误 here。但是,如果类具有依赖关系,则抛出VerifyError 在某些其他类上,该类在编译后不兼容地更改。但是SubstringComparator和ByteArrayComparable类都是同一个jar文件hbase_client [v0.98.3-hadoop2]的一部分。
此外,该应用程序正常运行。它只是抛出这个错误的测试用例。有人可以解释一下是什么问题吗?