我现在需要做一个项目,需要利用华为的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 {
NmsSession_I nmsSession = null;
//用户名,密码
emsSessionFactory_I.getEmsSession("xwtech","hwfx456!!", nmsSession, sessionHolder);
System.out.println("NMSsession ---" + nmsSession.toString());
}catch (globaldefs.ProcessingFailureException ex) {
System.out.println("获取EmsSession引用对象,异常!---ProcessingFailureException---");
System.out.println("可能是用户名或者密码错误,或者权限不够,或者已登陆的用户还未退出!");
System.out.println(ex.toString());
}
emsSession = sessionHolder.value;
Common_IHolder common_IHolder = new Common_IHolder();
try {
emsSession.getManager("emsMgr", common_IHolder);
emsMgr = EMSMgr_IHelper.narrow(common_IHolder.value);
} catch (globaldefs.ProcessingFailureException e) {
e.printStackTrace();
}
}
public static void main(String[] args){
testTai();
// Thread corba = new Thread(new Client(),"corba");
// corba.start();
}
}现在在emsSessionFactory_I.getEmsSession("xwtech","hwfx456!!", nmsSession, sessionHolder);出现错误,
globaldefs.ProcessingFailureException: IDL:mtnm.tmforum.org/globaldefs/Processi
gFailureException:1.0
Exception in thread "main" java.lang.NullPointerException
at Client_start.testTai(Client_start.java:84)
at Client_start.main(Client_start.java:92)请问这是什么问题,前面的执行都能执行成功,能够获得orb,EmsSessionFactory等,直到最后一步出现错误,是不是有可能是用户名密码的问题?这是华为那边提供的。
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 {
NmsSession_I nmsSession = null;
//用户名,密码
emsSessionFactory_I.getEmsSession("xwtech","hwfx456!!", nmsSession, sessionHolder);
System.out.println("NMSsession ---" + nmsSession.toString());
}catch (globaldefs.ProcessingFailureException ex) {
System.out.println("获取EmsSession引用对象,异常!---ProcessingFailureException---");
System.out.println("可能是用户名或者密码错误,或者权限不够,或者已登陆的用户还未退出!");
System.out.println(ex.toString());
}
emsSession = sessionHolder.value;
Common_IHolder common_IHolder = new Common_IHolder();
try {
emsSession.getManager("emsMgr", common_IHolder);
emsMgr = EMSMgr_IHelper.narrow(common_IHolder.value);
} catch (globaldefs.ProcessingFailureException e) {
e.printStackTrace();
}
}
public static void main(String[] args){
testTai();
// Thread corba = new Thread(new Client(),"corba");
// corba.start();
}
}现在在emsSessionFactory_I.getEmsSession("xwtech","hwfx456!!", nmsSession, sessionHolder);出现错误,
globaldefs.ProcessingFailureException: IDL:mtnm.tmforum.org/globaldefs/Processi
gFailureException:1.0
Exception in thread "main" java.lang.NullPointerException
at Client_start.testTai(Client_start.java:84)
at Client_start.main(Client_start.java:92)请问这是什么问题,前面的执行都能执行成功,能够获得orb,EmsSessionFactory等,直到最后一步出现错误,是不是有可能是用户名密码的问题?这是华为那边提供的。
解决方案 »
- Hibernate使用Sequence向Oracle中插入数据报错
- 大家圣诞节快乐 !帮我看一下路径的问题!
- 如何获取一个checkbox的value值在线等 急救啊
- 查询统计的SQL问题
- tomcat能启动,但是就是打不开网页;Google看了都不管用
- Spring2.0+Struts1.3+Hibernate3.1启动服务器报错
- struts2如何初始一个类?(急)
- ssh 网站菜单项 缓存到什么地方?session?cookie?
- 大家都来谈谈自己的看法
- 为什么这段程序不能在jdk1.3.1中运行
- 使用nutch抓取别人网站主要实现什么需求
- 安卓虚拟器老出现这个an android virtual device that failed to load. 怎么回事啊,求解决
看看下面代码:
POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootpoa.the_POAManager().activate();
NmsSession_I nmsSessionImpl = new NmsSession_Impl();
NmsSession_I csession = null; NmsSession_IPOATie tie = new NmsSession_IPOATie(nmsSessionImpl,rootpoa);
csession = tie._this(orb);org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");NamingContext namingContext = NamingContextHelper.narrow(objRef);
System.out.println(namingContext);NameComponent name[] = new NameComponent[5];
name[0] = new NameComponent("TMF_MTNM","Class");
name[1] = new NameComponent("HUAWEI","Vendor");
name[2] = new NameComponent("Huawei/U2000","EmsInstance");
name[3] = new NameComponent("2.0","Version");
name[4] = new NameComponent("Huawei/U2000","EmsSessionFactory_I");org.omg.CORBA.Object obj;
obj = namingContext.resolve(name);System.out.println(obj);//获取EmsSession 的对象引用并登录EmsSession_IHolder emssession_holder = new EmsSession_IHolder();EmsSessionFactory_I sfobj = EmsSessionFactory_IHelper.narrow(obj);sfobj.getEmsSession("corba1111","admin1234",csession,emssession_holder);System.out.println(csession);emsSession = emssession_holder.value;
EmsSessionFactory::getEmsSession("corba1111","admin1234",csession,emssession_holder);
我将nms传入的csession参数保存后,对其调用ping()函数,如果在getEmsSession()之外调用,总是触发本地内存访问错误,何故?
Comm.getInstance().emsSessionFactory.getEmsSession(user, passwd,
Comm.getInstance().nmsSession,
Comm.getInstance().emsSession_IHolder);
这里除了问题,可以说说要怎么解决吗?拜托!
globaldefs.ProcessingFailureException: IDL:mtnm.tmforum.org/globaldefs/ProcessingFailureException:1.0
at globaldefs.ProcessingFailureExceptionHelper.read(ProcessingFailureExceptionHelper.java:38)
at emsSessionFactory._EmsSessionFactory_IStub.getEmsSession(_EmsSessionFactory_IStub.java:89)
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 com.kingtake.common.util.CorbaClientPtnHw.testCorba(CorbaClientPtnHw.java:97)
at com.kingtake.common.util.CorbaClientPtnHw.main(CorbaClientPtnHw.java:203)请问知道是什么问题吗?