Error Java Corba BAD_PARAM -
i trying establish connection huawei u2000 nbi corba alarms using .ior file connect. have idl files compiled java. below main code initializing orb
package com.be.u2k; import java.io.bufferedreader; import java.io.file; import java.io.filereader; import org.omg.corba.orb; import alarmirpsystem.alarmirp; import alarmirpsystem.alarmirphelper; public class main { public static void main(string[] args) { try { string filename = system.getproperty ("user.home") + system.getproperty ("file.separator")+"u2k.ior"; file f = new file(filename); if (!f.exists()) { system.out.println("file " + filename + " not exist."); system.exit(-1); } else if (f.isdirectory()) { system.out.println("file " + filename + " directory."); system.exit(-1); } bufferedreader br = new bufferedreader(new filereader(f)); string iorcontents = br.readline(); br.close(); orb orbwithior = orb.init(args, null); org.omg.corba.object obj = orbwithior.string_to_object(iorcontents); alarmirp alarmirp = alarmirphelper.narrow(obj); system.out.println("alarmirphelper.narrow success!") ; } catch (exception e) { system.out.println("error : " + e) ; e.printstacktrace(system.out); } } }
why keep getting bad_param error when running with
java -jar serveru2kalarm.jar
admin@ip-10-44-0-10:~$ java -jar serveru2kalarm.jar error : org.omg.corba.bad_param: vmcid: 0x0 minor code: 0 completed: no org.omg.corba.bad_param: vmcid: 0x0 minor code: 0 completed: no @ alarmirpsystem.alarmirphelper.narrow(alarmirphelper.java:60) @ com.be.u2k.main.main(main.java:36)
did miss out orb object? thanks.
i'm dealing same issue now. first have epirp hw u2000. here example code alarmirp.code not yet completed. ior of service used, relevant irpid , irpclassname must given in get_irp_reference method.
for manageridentifier read explanation: manageridentifier value
image hw u2000 relations between irps
*** properties properties = new properties(); properties.put("org.omg.corba.orbclass", "org.jacorb.orb.orb"); properties.put("org.omg.corba.orbsingletonclass", "org.jacorb.orb.orbsingleton"); properties.put("orbinitref.nameservice", settings.getiorstring()); // connect name service orb orb = orb.init((string[]) null, properties); poa poa = poahelper.narrow(orb.resolve_initial_references(settings.getrootpoaname())); poa.the_poamanager().activate(); logger.info("orb init success"); org.omg.corba.object obj = orb.string_to_object(settings.getiorstring()); string epirpversion = null; string systemdn = null; string irpid = null; string irpclassname = null; epirp epirp = epirphelper.narrow(obj); string[] epirpversions = epirp.get_ep_irp_versions(); (string str : epirpversions) { if (null != str && !"".equals(str.trim())) { epirpversion = str; } } supportedirplisttypeholder supportedirplist = new supportedirplisttypeholder(); if (resulttype._ok == epirp.get_irp_outline("", supportedirplist).value()) { supportedirplisttypeelement[] typeholder = supportedirplist.value; (supportedirplisttypeelement irplistele : typeholder) { systemdn = irplistele.systemdn; logger.info("dntype: " + systemdn); (irpelement irpelement : irplistele.irplist) { irpid = irpelement.irpid; logger.info("irpid: " + irpid); irpclassname = irpelement.irpclassname; logger.info("irpclassname: " + irpclassname); logger.info("irpversion: " + irpelement.irpversion); logger.info("irpmanagementscope: "); (string s : irpelement.irpmanagementscope.value()) { logger.info(s); } } } } else { logger.error("failed"); } stringholder alarmirpior = new stringholder(); epirp.get_irp_reference(manageridentifier, systemdn, irpid, irpclassname, alarmirpior); logger.info("alarmirp:" + alarmirpior.value); //connect alarmirp alarmirp alarmirp = alarmirphelper.narrow(orb.string_to_object(alarmirpior.value));
Comments
Post a Comment