ERROR org.omg.CORBA.MARSHAL序列长度过大(ERROR org.omg.CO

2019-10-29 07:13发布

成功地从CORBA的网管服务器获取报警和现在读值后,我收到以下错误

ERROR: org.omg.CORBA.MARSHAL: Sequence length too large. Only 12 available and trying to assign 31926513  vmcid: 0x0  minor code: 0  completed: No
org.omg.CORBA.MARSHAL: Sequence length too large. Only 12 available and trying to assign 31926513  vmcid: 0x0  minor code: 0  completed: No
at org.omg.CosNotification.EventBatchHelper.read(EventBatchHelper.java:57)
at AlarmIRPConstDefs.AlarmInformationSeqHelper.read(AlarmInformationSeqHelper.java:51)
at AlarmIRPConstDefs.AlarmInformationSeqHelper.extract(AlarmInformationSeqHelper.java:26)
at com.be.u2k.Main.getAlarmsList(Main.java:144)
at com.be.u2k.Main.main(Main.java:109)

对于方法AlarmInformationSeqHelper.extract

// Get all active alarms list
private static void getAlarmsList(ORB orb, AlarmIRP alarmIRP) {
    try {
        ManagedGenericIRPConstDefs.StringTypeOpt filter = new ManagedGenericIRPConstDefs.StringTypeOpt();
        filter.value("($type_name == 'x1')"); // Query new alarms and acknowledge or unacknowledge alarms
        AlarmIRPConstDefs.DNTypeOpt base_object = new AlarmIRPConstDefs.DNTypeOpt();
        BooleanHolder flag = new BooleanHolder();
        AlarmIRPSystem.AlarmInformationIteratorHolder iter = new AlarmIRPSystem.AlarmInformationIteratorHolder();
        StructuredEvent[] alarmList = alarmIRP.get_alarm_list(filter, base_object, flag, iter);
        System.out.println("AlarmIRP get_alarm_list success, flag: " + flag.value + " fetched total: " + (alarmList == null? -1: alarmList.length));

        for (StructuredEvent alarm: alarmList) {
            if (alarm.header != null) {
                System.out.println("fixed_header.event_type.name: " + alarm.header.fixed_header.event_type.type_name
                        + " fixed_header.event_type.domain_name: " + alarm.header.fixed_header.event_type.domain_name);
                if (alarm.header.variable_header != null) {
                    for (Property variableHeader: alarm.header.variable_header) {
                        System.out.println("variable_header.name: " + variableHeader.name + " alarm.header.variable_header.value: " +  variableHeader.value);
                    }
                }
            }

            if (alarm.filterable_data != null) {
                for (Property filterableData: alarm.filterable_data) {
                    System.out.println("data.name: " + filterableData.name);
                    if (filterableData.value != null && filterableData.value.toString().contains("org.jacorb.orb.CDROutputStream")) {
                        StructuredEvent[] filterableDataValues = AlarmInformationSeqHelper.extract(filterableData.value);
                    } else {
                        System.out.println("data.value: " + filterableData.value);
                    }
                }
            }
        }

    } catch (ManagedGenericIRPSystem.InvalidParameter e) {
        System.out.println("ERROR get_alarm_list InvalidParameter (Indicates that the parameter is invalid): " + e) ;   
    } catch (ManagedGenericIRPSystem.ParameterNotSupported e) {
        System.out.println("ERROR get_alarm_list ParameterNotSupported (Indicates that the operation is not supported): " + e) ;    
    } catch (AlarmIRPSystem.GetAlarmList e) {
        System.out.println("ERROR get_alarm_list ParameterNotSupported (Indicates exceptions caused by unknown reasons): " + e) ;   
    }
}

或者是我的阅读列表报警不正确的方法? 谢谢。

Answer 1:

你可以找到下面的方法实例getAlarmList

//Connect to AlarmIRP
AlarmIRP alarmIRP = AlarmIRPHelper.narrow(orb.string_to_object(alarmIrpIOR.value));
StringTypeOpt alarmFilter = new StringTypeOpt();
alarmFilter.value("");
DNTypeOpt base_object = new DNTypeOpt();
base_object.value("");
BooleanHolder flag = new BooleanHolder(false);  // false for iteration
AlarmInformationIteratorHolder iter = new AlarmInformationIteratorHolder();

List<String> alarmIds = get_alarm_list(alarmIRP, alarmFilter, base_object, flag, iter);

private List<String> get_alarm_list(org._3gppsa5_2.AlarmIRPSystem.AlarmIRP alarmIRP, org._3gppsa5_2.ManagedGenericIRPConstDefs.StringTypeOpt alarmFilter, org._3gppsa5_2.AlarmIRPConstDefs.DNTypeOpt base_object, BooleanHolder flag, org._3gppsa5_2.AlarmIRPSystem.AlarmInformationIteratorHolder iter) throws org._3gppsa5_2.AlarmIRPSystem.GetAlarmList, org._3gppsa5_2.ManagedGenericIRPSystem.ParameterNotSupported, org._3gppsa5_2.AlarmIRPSystem.NextAlarmInformations, org._3gppsa5_2.ManagedGenericIRPSystem.InvalidParameter, BAD_OPERATION {
    logger.info("[get-alarm-list][start]");
    alarmIRP.get_alarm_list(alarmFilter, base_object, flag, iter);

    List<StructuredEvent> alarms = new ArrayList();
    EventBatchHolder alarmInformation = new EventBatchHolder();
    short alarmSize = 100;
    List<String> alarmIds = new ArrayList();
    while (iter.value.next_alarmInformations(alarmSize, alarmInformation)) {
        alarms.addAll(Arrays.asList(alarmInformation.value));
        logger.info("Current alarm size:" + alarms.size());
    }

    for (StructuredEvent event : alarms) {
        try {
        //printAlarm(event);
        } catch (Exception ex) {
        }
        List<Property> rem = new ArrayList<Property>();
        rem.addAll(Arrays.asList(PropertySeqHelper.extract(event.remainder_of_body)));
        for (Property property : rem) {
        if (!property.name.equals(org._3gppsa5_2.AlarmIRPNotifications.NotifyNewAlarm.ALARM_ID)) {
            continue;
        }

        alarmIds.add(property.value.extract_string());
        }
    }
    logger.info("[get-alarm-list][completed] size :" + alarms.size());

    return alarmIds;
}


Answer 2:

我设法弄清楚什么是filterableData.value.toString()值是“org.jacorb.orb.CDROutputStream”。 事实证明,名称为“B”的属性是TimeBase:: UtcT根据文档。

为了将其转换为正确的值,它是一个UTC时间戳记,我改变了条件

if (filterableData.name.equals("b") && filterableData.value != null && filterableData.value.toString().contains("org.jacorb.orb.CDROutputStream")) {
    long occuranceTime = TimeTHelper.read(filterableData.value.create_input_stream());
    System.out.println("data.value: " + occuranceTime);
}


文章来源: ERROR org.omg.CORBA.MARSHAL Sequence length too large