我正在使用 CORBA网络管理规范,我想获取包含连接到 CORBA 服务所需的信息的 IOR 文件。有一些关于如何从我发布的链接中获取“ExternalNameService.ior”文件的信息,但我不知道该怎么做。基本上我知道我想做的是:
- 获取 IOR。
- 对其进行解码,以便我获得 CORBA 服务的 IP 和端口。
- 编译 IDL 并使用它们连接到远程资源。
我坚持的部分是获取 IOR。有任何想法吗?
编辑
我正在尝试提供我自己的探测实现......不使用 IBM 的。文章简单显示了命名服务的名称,由于某种原因我无法连接到它......这是我最大的问题。如果我尝试连接到本地名称服务,则以下代码有效,但对于爱立信则失败。我提供了正确的ORBInitialPort
和ORBInitialHost
作为命令行参数。
ORB orb = ORB.init(args, null);
String corbalocURL = "ExternalNameService";
// get the root naming context
org.omg.CORBA.Object objRef = orb.resolve_initial_references(corbalocURL);
// Use NamingContextExt instead of NamingContext. This is
// part of the Interoperable naming Service.
System.out.println(objRef);
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
System.out.println(ncRef);
这些是我得到的错误:
ERROR : org.omg.CORBA.OBJECT_NOT_EXIST: vmcid: 0x0 minor code: 0 completed: No
org.omg.CORBA.OBJECT_NOT_EXIST: vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:374)
at java.lang.Class.newInstance(Class.java:327)
at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:914)
at com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_0.getSystemException(ReplyMessage_1_0.java:111)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:590)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:459)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:355)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:147)
at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.invoke(BootstrapResolverImpl.java:114)
at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.list(BootstrapResolverImpl.java:151)
at com.sun.corba.se.impl.resolver.CompositeResolverImpl.list(CompositeResolverImpl.java:55)
at com.sun.corba.se.impl.resolver.CompositeResolverImpl.list(CompositeResolverImpl.java:55)
at com.sun.corba.se.impl.resolver.CompositeResolverImpl.list(CompositeResolverImpl.java:55)
at com.sun.corba.se.impl.orb.ORBImpl.list_initial_services(ORBImpl.java:1143)
at HelloClient.main(HelloClient.java:22)