错误 Java Corba BAD_PARAM
Error Java Corba BAD_PARAM
我正在尝试建立与华为 U2000 NBI corba 的连接,以使用 .ior 文件进行连接以获取警报。我已经将 IDL 文件编译为 Java。下面是我初始化 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 + " does not exist.");
System.exit(-1);
} else if (f.isDirectory()) {
System.out.println("File " + filename + " is a 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);
}
}
}
为什么当 运行 使用
时,我总是收到 BAD_PARAM 错误
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
at AlarmIRPSystem.AlarmIRPHelper.narrow(AlarmIRPHelper.java:60)
at com.be.u2k.Main.main(Main.java:36)
我是否遗漏了我的 ORB 对象的任何内容?谢谢。
我现在正在处理同样的问题。首先,您必须获得 HW U2000 的 EPIRP。这是尚未完成的示例代码 AlarmIRP.Code。要获取要使用的服务的IOR,必须在get_IRP_reference方法中给出相关的irpId和irpClassName。
对于 managerIdentifier,请阅读以下解释:managerIdentifier value
Image for 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 to 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();
for (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;
for (SupportedIRPListTypeElement irpListEle : typeHolder) {
systemDn = irpListEle.systemDN;
logger.info("dnType: " + systemDn);
for (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: ");
for (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 to AlarmIRP
AlarmIRP alarmIRP = AlarmIRPHelper.narrow(orb.string_to_object(alarmIrpIOR.value));
我正在尝试建立与华为 U2000 NBI corba 的连接,以使用 .ior 文件进行连接以获取警报。我已经将 IDL 文件编译为 Java。下面是我初始化 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 + " does not exist.");
System.exit(-1);
} else if (f.isDirectory()) {
System.out.println("File " + filename + " is a 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);
}
}
}
为什么当 运行 使用
时,我总是收到 BAD_PARAM 错误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
at AlarmIRPSystem.AlarmIRPHelper.narrow(AlarmIRPHelper.java:60)
at com.be.u2k.Main.main(Main.java:36)
我是否遗漏了我的 ORB 对象的任何内容?谢谢。
我现在正在处理同样的问题。首先,您必须获得 HW U2000 的 EPIRP。这是尚未完成的示例代码 AlarmIRP.Code。要获取要使用的服务的IOR,必须在get_IRP_reference方法中给出相关的irpId和irpClassName。
对于 managerIdentifier,请阅读以下解释:managerIdentifier value
Image for 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 to 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();
for (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;
for (SupportedIRPListTypeElement irpListEle : typeHolder) {
systemDn = irpListEle.systemDN;
logger.info("dnType: " + systemDn);
for (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: ");
for (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 to AlarmIRP
AlarmIRP alarmIRP = AlarmIRPHelper.narrow(orb.string_to_object(alarmIrpIOR.value));