class A extends KeyedProcessFunction<String, Object, String> implements CheckpointedFunction {
private MapState<String, LiveBean> liveBeanState; @Override public void initializeState(FunctionInitializationContext context) throws Exception { MapStateDescriptor<String, LiveBean> descriptor = new MapStateDescriptor<>("liveState", BasicTypeInfo.STRING_TYPE_INFO, TypeInformation.of(LiveBean.class)); this.liveBeanState = context.getKeyedStateStore().getMapState(descriptor); } @Override public void snapshotState(FunctionSnapshotContext context) throws Exception { Iterator<Map.Entry<String, LiveBean>> iter = liveBeanState.iterator(); // -> Exception here while (iter.hasNext()) { Map.Entry<String, LiveBean> e = iter.next(); hbaseDao.singlePut("table", StringUtils.reverse(e.getKey()), "cf", "info", JSON.toJSONString(e.getValue())); } } } ???????????? java.lang.NullPointerException: No key set. This method should not be called outside of a keyed context. ??????checkpoint????????????????????hbase??????????????