日期:2014-05-20  浏览次数:20664 次

急,真心求教华为U2000的连接问题
我现在需要做一个项目,需要利用华为的U2000去开通传输电路,现在在连接U2000的时候出现了问题,我是利用网上连接T2000的代码去连接T2000的,在获取emssession时出现错误。代码如下:
import org.omg.CORBA.ORB;  
import org.omg.CORBA.SystemException;  
  
import CosNaming.NameComponent;  
import CosNaming.NamingContext;  
import CosNaming.NamingContextHelper;  
import emsMgr.EMSMgr_I;  
import emsSession.EmsSession_I;  
import emsSession.EmsSession_IHolder;  
import emsSessionFactory.EmsSessionFactory_I;  
import emsSessionFactory.EmsSessionFactory_IHelper;
import nmsSession.*;
import common.*;
import emsMgr.*;
import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;
  
public class Client_start {  
  static ORB orb;  
  static EMSMgr_I emsMgr = null;  
  static EmsSession_I emsSession=null;  
   
  public static void testTai(){  
  //建立连接登录、建立消息通道  
  try {  
  String[] args = new String[2];  
  args[0] = "-ORBInitRef";  
  args[1] = "NameService=corbaloc::132.232.4.130:12001/NameService";  
  
  orb = org.omg.CORBA.ORB.init(args, null);  
   
  } catch (SystemException ex) {  
  System.out.println("初始化ORB对象异常!");  
  }  
  
  //NameService  
  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();  
  }  
  
  //EMSSessionFactory
  NameComponent tmfClass = new NameComponent("TMF_MTNM", "Class");
NameComponent tmfVendor = new NameComponent("HUAWEI", "Vendor");
NameComponent tmfEmsInstance = new NameComponent("Huawei/U2000","EmsInstance");
NameComponent tmfVersion = new NameComponent("2.0", "Version");
NameComponent tmfEntity = new NameComponent("Huawei/U2000","EmsSessionFactory_I");  
  //NameComponent nc = new NameComponent("Huawei/U2000", "EmsSessionFactory_I");  
  NameComponent path[] = { tmfClass, tmfVendor, tmfEmsInstance,tmfVersion, tmfEntity };;  
   
  EmsSessionFactory_I emsSessionFactory_I = null;  
  org.omg.CORBA.Object obj = null;  
  try{  
  obj = namingContext.resolve(path);  
  System.out.println("orb"+obj);  
  emsSessionFactory_I = EmsSessionFactory_IHelper.narrow(obj);  
  System.out.println("成功获得EmsSessionFactory"+emsSessionFactory_I);  
  }catch(Exception e){  
  e.printStackTrace();  
  }  
  
  EmsSession_IHolder sessionHolder = new EmsSession_IHolder();  
try {