The exception java.lang.VerifyError: Bad type on operand stack happend in Heron

The exception java.lang.VerifyError: Bad type on operand stack happend in Heron

我尝试使用以下代码从 zookeeper 获取 PhysicalPlan:

String stateMgrClass = Context.stateManagerClass(this.config);
IStateManager stateManager = null;
stateManager = ReflectionUtils.newInstance(stateMgrClass);
stateManager.initialize(this.config);
SchedulerStateManagerAdaptor stateManagerAdaptor = new SchedulerStateManagerAdaptor(stateManager, 5000);
PhysicalPlans.PhysicalPlan physicalPlan = stateManagerAdaptor.getPhysicalPlan(this.topologyName);

然后出现异常:java.lang.VerifyError:发生操作数堆栈类型错误:

Exception in thread "Thread-4" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    com/twitter/heron/proto/system/PhysicalPlans$PhysicalPlan$Builder.mergeTopology(Lcom/twitter/heron/api/generated/TopologyAPI$Topology;)Lcom/twitter/heron/proto/system/PhysicalPlans$PhysicalPlan$Builder; @72: invokevirtual
  Reason:
    Type 'com/twitter/heron/api/generated/TopologyAPI$Topology' (current frame, stack[1]) is not assignable to 'com/google/protobuf/AbstractMessage'
  Current Frame:
    bci: @72
    flags: { }
    locals: { 'com/twitter/heron/proto/system/PhysicalPlans$PhysicalPlan$Builder', 'com/twitter/heron/api/generated/TopologyAPI$Topology' }
    stack: { 'com/google/protobuf/SingleFieldBuilderV3', 'com/twitter/heron/api/generated/TopologyAPI$Topology' }
  Bytecode:
    0x0000000: 2ab4 0014 c700 3f2a b400 1604 7e04 a000
    0x0000010: 292a b400 09c6 0022 2ab4 0009 b800 4fa5
    0x0000020: 0018 2a2a b400 09b8 0055 2bb6 0056 b600
    0x0000030: 57b5 0009 a700 082a 2bb5 0009 2ab6 0037
    0x0000040: a700 0c2a b400 142b b600 5857 2a59 b400
    0x0000050: 1604 80b5 0016 2ab0                    
  Stackmap Table:
    same_frame(@55)
    same_frame(@60)
    same_frame(@67)
    same_frame(@76)

    at com.twitter.heron.proto.system.PhysicalPlans$PhysicalPlan.toBuilder(PhysicalPlans.java:4211)
    at com.twitter.heron.proto.system.PhysicalPlans$PhysicalPlan.newBuilder(PhysicalPlans.java:4204)
    at com.twitter.heron.statemgr.FileSystemStateManager.getPhysicalPlan(FileSystemStateManager.java:165)
    at com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor.getPhysicalPlan(SchedulerStateManagerAdaptor.java:289)
    at zyt.custom.my.scheduler.aurora.AuroraSchedulerController.basedWeightSchedule(AuroraSchedulerController.java:782)
    at zyt.custom.my.scheduler.aurora.AuroraSchedulerThread.run(AuroraSchedulerThread.java:54)

我不知道是什么导致了这个异常。感谢您的帮助。

当class 的版本在编译时和运行时不同时会出现异常。

最近,当我尝试使用旧版本的探查器时遇到了这样的问题,当探查器启动时,正是要调用某个操作的时候 verifyError 被抛出。

这个问题已通过从 pom.xml 文件中删除 heron-api:[heron-version].jar 得到解决。
heron-spi:[heron-version].jar 是创建 Heron 的自定义调度程序所必需的。