首页 新闻 会员 周边

华为 u2000 连接 CosNaming.NamingContextPackage.NotFound

0
悬赏园豆:50 [已解决问题] 解决于 2014-08-20 08:48

在调用华为北向 U2000 时候
需要通过 EmsSessionFactory_I 接口实例化对像
     调用  EmsSessionFactory_I 接口的getEmsSession 方法来进行登录连接.
在实例化 EmsSessionFactory_I 的过程中
     使用 EmsSessionFactory_IHelper.narrow(obj) 的方法 处理 org.omg.CORBA.Object 类型的  obj 对象.
由于 obj 对象需要通过  obj= ncRef.resolve(path); 获取..

 path[] 
        NameComponent path[] = new NameComponent[5];
        path[0] = new NameComponent("TMF_MTNM","Class");
        path[1] = new NameComponent("HUAWEI","Vendor");
        path[2] = new NameComponent("Huawei/U2000","EmsInstance");
        path[3] = new NameComponent("2.0","Version");
        path[4] = new NameComponent("Huawei/U2000","EmsSessionFactory_I");

我在编写客户端连接服

public class ClientTest {   
    static ORB orb;     
    static EMSMgr_I emsMgr = null;     
    static EquipmentInventoryMgr_I equipmentInventoryMgr = null;
    static EmsSession_I emsSession=null;     

    static EMS_THolder emsHolder = null; 
    static EMS_T ems = null;  

    static EventChannel notifChannel = null; 
    static EventChannelHolder chanHolder = new EventChannelHolder(); 

    static ConsumerAdmin cadmin = null;
    static IntHolder id = null;
    static ProxySupplier baseSupplier = null;
    static StructuredProxyPushSupplier structuredProxyPushSupplier = null;

    static ManagedElementMgr_I managedElementMgr=null;

    static StructuredPushConsumerImpl structProxyPushConsumer = null;
    static POA rpoa = null;
    static POA poa = null;

    static Date start_time=new Date();    
    static Date end_time=new Date();    


    public static void testCorba() throws UnsupportedEncodingException{     
        //建立连接登录、建立消息通道    
        try {    
            String[] args = new String[2];   
            args[0] = "-ORBInitRef";   
            args[1] = "NameService=corbaloc::10.0.1.1:12001/NameService";        
            orb = org.omg.CORBA.ORB.init(args, null);    
        } catch (SystemException ex) {     
            System.out.println("初始化ORB对象异常!");    
        }     

        NamingContext namingContext = null;    
        org.omg.CORBA.Object objRef = null;   
        try {    
            objRef = orb.resolve_initial_references("NameService");   
            namingContext = NamingContextHelper.narrow(objRef);   
            System.out.println("获取取名字服务成功:"+namingContext);
        }catch (org.omg.CORBA.ORBPackage.InvalidName ex) {    
            System.out.println("获取名字服务索引异常!");   
            ex.printStackTrace();   
        }    

NameComponent[] path = new NameComponent[5]; path[0] = new NameComponent("TMF_MTNM", "Class"); path[1] = new NameComponent("HUAWEI", "Vendor"); path[2] = new NameComponent("Huawei/T2000", "EmsInstance"); path[3] = new NameComponent("2.0", "Version"); path[4] = new NameComponent("Huawei/T2000", "EmsSessionFactory_I");

        EmsSessionFactory_I emsSessionFactory_I = null;   
        org.omg.CORBA.Object obj = null;   
        try{               
            obj = namingContext.resolve(path);   
            System.out.println("obj=>"+obj);   
            emsSessionFactory_I = EmsSessionFactory_IHelper.narrow(obj);   
            System.out.println("emsSessionFactory_I=>"+emsSessionFactory_I);   
        }catch(Exception e){   
            e.printStackTrace();   
        }
}
}

 

务器端代码的时候, 执行上面 path 代码的时候,编译器的错误提示:CosNaming.NamingContextPackage.NotFound.
但是事实结果是存在CosNaming.NamingContextPackage的.
希望大家能够帮我解答,,谢谢
  PS:附上前辈的代码 ..

空城空城空的主页 空城空城空 | 初学一级 | 园豆:159
提问于:2014-08-18 20:17
< >
分享
最佳答案
0

这个问题太冷门了…

收获园豆:50
Firen | 大侠五级 |园豆:5385 | 2014-08-20 08:43

首先 感谢你的关注 ..
  虽然冷门但你不是也关注了吗??
这问题已经解决了
  还是感谢你的关注 ,,

空城空城空 | 园豆:159 (初学一级) | 2014-08-20 08:45

莫名其妙就 给你50豆子了,,
  我自己的答案....

空城空城空 | 园豆:159 (初学一级) | 2014-08-20 08:49
其他回答(1)
0

NameComponent[] path = new NameComponent[5];

 path[0] = new NameComponent("TMF_MTNM", "Class");

 path[1] = new NameComponent("HUAWEI", "Vendor");

 path[2] = new NameComponent("Huawei/T2000", "EmsInstance"); 

 path[3] = new NameComponent("2.0", "Version"); 

 path[4] = new NameComponent("Huawei/T2000", "EmsSessionFactory_I");

 

//以上TMF_MTNM    HUAWEI    2.0  都是华为缺省值

//Huawei/T2000-------------网管系统在上层OSS中的标识。当网络规划中,需要配置多个U2000系统时,需要修改此配置参数,以确保不同的U2000系统的名字在NMS管理域内是唯一的。

(这个值要向华为要...华为给出的

服务器的名字服务器(emsname):

T2000:   PUT-T2000-1-P

U2000:   PUT-U2000-1-P )

 

EmsSessionFactory_I emsSessionFactory_I = null; org.omg.CORBA.Object obj = null; try{ obj = namingContext.resolve(path);/* 当运行到上面这行出现以下错误的时候:1.当传入5 个 或少于5个 参数 CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0 at CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72) at CosNaming._NamingContextStub.resolve(_NamingContextStub.java:151) at clinet.CorbaClientPtnHw.main(CorbaClientPtnHw.java:93) 2. 当传入 1 个或 2 个 参数的时候 可以得到 obj 的数据(下面这行System.out.println("obj=>"+obj); 可以显示但是将 obj 传到下面第二行的时候 emsSessionFactory_I = EmsSessionFactory_IHelper.narrow(obj);)提示如下 org.omg.CORBA.BAD_PARAM: vmcid: 0x0 minor code: 0 completed: No at emsSessionFactory.EmsSessionFactory_IHelper.narrow(EmsSessionFactory_IHelper.java:70) at clinet.CorbaClientPtnHw.main(CorbaClientPtnHw.java:103)得出结论:NameComponent 数值不匹配. */

空城空城空 | 园豆:159 (初学一级) | 2014-08-20 08:47
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册